Merge pull request #700 pinheadmz/blockjson
block: inspect() expects buffer from getCommitmentHash()
This commit is contained in:
commit
ea1c6becb5
@ -539,7 +539,7 @@ class Block extends AbstractBlock {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
format(view, height) {
|
format(view, height) {
|
||||||
const commitmentHash = this.getCommitmentHash('hex');
|
const commitmentHash = this.getCommitmentHash();
|
||||||
return {
|
return {
|
||||||
hash: this.rhash(),
|
hash: this.rhash(),
|
||||||
height: height != null ? height : -1,
|
height: height != null ? height : -1,
|
||||||
|
|||||||
@ -28,6 +28,9 @@ const compact426884 = common.readCompact('compact426884');
|
|||||||
const block898352 = common.readBlock('block898352');
|
const block898352 = common.readBlock('block898352');
|
||||||
const compact898352 = common.readCompact('compact898352');
|
const compact898352 = common.readCompact('compact898352');
|
||||||
|
|
||||||
|
// Small SegWit block test vector
|
||||||
|
const block482683 = common.readBlock('block482683');
|
||||||
|
|
||||||
// Sigops counting test vectors
|
// Sigops counting test vectors
|
||||||
// Format: [name, sigops, weight]
|
// Format: [name, sigops, weight]
|
||||||
const sigopsVectors = [
|
const sigopsVectors = [
|
||||||
@ -102,6 +105,11 @@ describe('Block', function() {
|
|||||||
assert.bufferEqual(block2.merkleRoot, block2.createMerkleRoot());
|
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', () => {
|
it('should create a merkle block', () => {
|
||||||
const filter = BloomFilter.fromRate(1000, 0.01, BloomFilter.flags.NONE);
|
const filter = BloomFilter.fromRate(1000, 0.01, BloomFilter.flags.NONE);
|
||||||
|
|
||||||
|
|||||||
BIN
test/data/block482683.raw
Normal file
BIN
test/data/block482683.raw
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user