diff --git a/README.md b/README.md index cde9bc4..527252d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/cryptonote_core/cryptonote_basic.h b/src/cryptonote_core/cryptonote_basic.h index 0c4a0e8..1e8d66e 100644 --- a/src/cryptonote_core/cryptonote_basic.h +++ b/src/cryptonote_core/cryptonote_basic.h @@ -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) { diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 0000000..eab90d4 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash -x + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +cd $DIR +node sal.js || exit 1 \ No newline at end of file diff --git a/tests/sal.js b/tests/sal.js new file mode 100644 index 0000000..9eae71c --- /dev/null +++ b/tests/sal.js @@ -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); +}