Browse Source

bufferutils: fix pushDataInt output

hk-custom-address
Daniel Cousens 9 years ago
parent
commit
17c6ff62a0
  1. 4
      src/bufferutils.js
  2. 4
      test/fixtures/bufferutils.json

4
src/bufferutils.js

@ -10,8 +10,8 @@ function verifuint (value, max) {
function pushDataSize (i) { function pushDataSize (i) {
return i < opcodes.OP_PUSHDATA1 ? 1 return i < opcodes.OP_PUSHDATA1 ? 1
: i < 0xff ? 2 : i <= 0xff ? 2
: i < 0xffff ? 3 : i <= 0xffff ? 3
: 5 : 5
} }

4
test/fixtures/bufferutils.json

@ -34,7 +34,7 @@
"dec": 255, "dec": 255,
"hex64": "ff00000000000000", "hex64": "ff00000000000000",
"hexVI": "fdff00", "hexVI": "fdff00",
"hexPD": "4dff00" "hexPD": "4cff"
}, },
{ {
"dec": 65534, "dec": 65534,
@ -46,7 +46,7 @@
"dec": 65535, "dec": 65535,
"hex64": "ffff000000000000", "hex64": "ffff000000000000",
"hexVI": "fdffff", "hexVI": "fdffff",
"hexPD": "4effff0000" "hexPD": "4dffff"
}, },
{ {
"dec": 65536, "dec": 65536,

Loading…
Cancel
Save