@smartledger/bsv 9.14.0 → 9.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,10 +30,14 @@ const BufferWriter = bsv.encoding.BufferWriter
30
30
 
31
31
  const rawVectors = require('../test/data/bitcoin-sv/script_tests.json')
32
32
 
33
- // Mapped by name rather than by value. This library assigns MONOLITH and
34
- // MAGNETIC to 1<<18 and 1<<19, which are the bits the node uses for
35
- // SCRIPT_GENESIS and SCRIPT_UTXO_AFTER_GENESIS, so mapping by value would
36
- // quietly mean something else.
33
+ // Mapped by name rather than by value, and the reason is no longer the one this comment used
34
+ // to give. It said this library puts MONOLITH and MAGNETIC on 1<<18 and 1<<19, colliding with
35
+ // the node's SCRIPT_GENESIS and SCRIPT_UTXO_AFTER_GENESIS. That collision was real once and was
36
+ // removed: they moved to 1<<11 and 1<<12, which the node leaves unassigned. Bits 18 and 19 now
37
+ // mean the same thing on both sides.
38
+ //
39
+ // Name mapping is still right, for a better reason: the node has no MONOLITH or MAGNETIC flag
40
+ // at all, so there is no value to map to. A row names a rule; only the name is portable.
37
41
  const FLAG_MAP = {
38
42
  NONE: 'SCRIPT_VERIFY_NONE',
39
43
  P2SH: 'SCRIPT_VERIFY_P2SH',
@@ -184,6 +188,17 @@ function classifyFlags (flagStr) {
184
188
  * only the spending transaction carries the version under test.
185
189
  */
186
190
  function evaluate (row, flags) {
191
+ // DoTest's one flag adjustment, which the rows themselves do not state:
192
+ //
193
+ // if(flags & SCRIPT_VERIFY_CLEANSTACK) flags |= SCRIPT_VERIFY_P2SH;
194
+ //
195
+ // Without it a row naming CLEANSTACK alone is verified under a flag set the node refuses
196
+ // outright, so it fails for the wrong reason and the row silently stops testing clean
197
+ // stacks at all.
198
+ if ((flags & Interpreter.SCRIPT_VERIFY_CLEANSTACK) !== 0) {
199
+ flags |= Interpreter.SCRIPT_VERIFY_P2SH
200
+ }
201
+
187
202
  const scriptSig = fromBitcoindString(row.scriptSig)
188
203
  const scriptPubKey = fromBitcoindString(row.scriptPubKey)
189
204
 
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  'use strict'
2
2
  // GENERATED by scripts/sync-version.js on `npm version` — do not edit.
3
- module.exports = '9.14.0'
3
+ module.exports = '9.16.0'