diff --git a/lib/primitives/block.js b/lib/primitives/block.js index 6ddef2c1..02dbf015 100644 --- a/lib/primitives/block.js +++ b/lib/primitives/block.js @@ -539,7 +539,7 @@ class Block extends AbstractBlock { */ format(view, height) { - const commitmentHash = this.getCommitmentHash('hex'); + const commitmentHash = this.getCommitmentHash(); return { hash: this.rhash(), height: height != null ? height : -1, diff --git a/test/block-test.js b/test/block-test.js index adef4223..b4ed2d6d 100644 --- a/test/block-test.js +++ b/test/block-test.js @@ -28,6 +28,9 @@ const compact426884 = common.readCompact('compact426884'); const block898352 = common.readBlock('block898352'); const compact898352 = common.readCompact('compact898352'); +// Small SegWit block test vector +const block482683 = common.readBlock('block482683'); + // Sigops counting test vectors // Format: [name, sigops, weight] const sigopsVectors = [ @@ -102,6 +105,11 @@ describe('Block', function() { assert.bufferEqual(block2.merkleRoot, block2.createMerkleRoot()); }); + it('should inspect a block with a witness commitment', () => { + const [block] = block482683.getBlock(); + assert(block.inspect()); + }); + it('should create a merkle block', () => { const filter = BloomFilter.fromRate(1000, 0.01, BloomFilter.flags.NONE); diff --git a/test/data/block482683.raw b/test/data/block482683.raw new file mode 100644 index 00000000..52cddffe Binary files /dev/null and b/test/data/block482683.raw differ