Merge pull request #700 pinheadmz/blockjson

block: inspect() expects buffer from getCommitmentHash()
This commit is contained in:
Braydon Fuller 2019-02-22 18:20:01 -08:00
commit ea1c6becb5
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4
3 changed files with 9 additions and 1 deletions

View File

@ -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,

View File

@ -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);

BIN
test/data/block482683.raw Normal file

Binary file not shown.