Skip to content

Commit

Permalink
Merge pull request #1 from machinomy/tech/fix-null-witness
Browse files Browse the repository at this point in the history
Tech/fix witness again

Co-authored-by: Sergey Ukustov <[email protected]>
  • Loading branch information
ARyaskov and ukstv authored Mar 6, 2019
2 parents bd7a094 + d71c016 commit 8136382
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/script/witness.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 8136382

Please sign in to comment.