Added SAL support

This commit is contained in:
MoneroOcean
2024-07-20 04:41:33 +03:00
parent 084ea7fd77
commit c696b5b43f
4 changed files with 23 additions and 2 deletions

View File

@@ -4,7 +4,8 @@ Node-CryptoForkNote-Util with Merged Mining support
Installing locally and testing
-----
```
npm install https://github.com/MoneroOcean/node-cryptoforknote-util
JOBS=$(nproc) npm install https://github.com/MoneroOcean/node-cryptoforknote-util
node_modules/cryptoforknote-util/tests/run.sh
```
Dependencies

View File

@@ -1080,7 +1080,7 @@ namespace cryptonote
if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
FIELD(pricing_record)
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
FIELD(salvium_pricing_record)
if (major_version >= 2) FIELD(salvium_pricing_record)
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
if (major_version >= 4)
{

6
tests/run.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
node sal.js || exit 1

14
tests/sal.js Normal file
View File

@@ -0,0 +1,14 @@
"use strict";
let u = require('../build/Release/cryptoforknote-util');
const b = Buffer.from(
'010194a5ebb406f613c4e7514facf3e5b9923c885357b53f2b02f8e17f9721371296b99113035f00000000020001ffcb6d018f9ffec12d03125e128c041c8a2d41fab9ebe2a7a4b10afbef4e134ec7ba3151c8c730a644310353414c3c7334015f99bdbbe70161dafb2da2fd9a4285da893a7519cff350981a959f525c43e5c60211000000000000000000000000000000000001e3c7bfb00b00020001ffcb6d0023016b6961b458286074406192961c1f0e5236455f45fcd6c175c7142d6353a481d60400020000'
, 'hex');
const b2 = u.convert_blob(b, 15);
if (b2.toString('hex') === '010194a5ebb406f613c4e7514facf3e5b9923c885357b53f2b02f8e17f9721371296b99113035f00000000ac81ca3e7bc9369e63563923187d2cfdb42eac839c7fe24e6d5d0080c96d758f02') {
console.log('PASSED');
else {
console.log('FAILED: ' + b2);
process.exit(1);
}