diff --git a/lib/script/witness.js b/lib/script/witness.js index 692717055..30f34ed1f 100644 --- a/lib/script/witness.js +++ b/lib/script/witness.js @@ -409,7 +409,7 @@ class Witness extends Stack { bw.writeVarint(this.items.length); for (const item of this.items) - bw.writeVarBytes(item); + bw.writeVarBytes(Buffer.from(item)); return bw; } @@ -431,7 +431,11 @@ class Witness extends Stack { */ toJSON() { - return this.toRaw().toString('hex'); + let result = this.toRaw().toString('hex'); + if (result === '00') { + result = ''; + } + return result; } /**