Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
fix: create buffers from decoded multihash digests (#287)
Browse files Browse the repository at this point in the history
`multihash.decode` returns Uint8Arrays which we set as `prevHash`
but bitcoin-lib requires these to be node Buffers.
  • Loading branch information
achingbrain committed Aug 5, 2020
1 parent 75037ea commit 28ecc2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ethereumjs-block": "^2.2.0",
"ipld-bitcoin": "^0.4.0",
"ipld-ethereum": "^5.0.0",
"ipld-git": "^0.6.0",
"ipld-git": "^0.6.1",
"ipld-in-memory": "^5.0.0",
"ipld-zcash": "^0.5.0",
"merkle-patricia-tree": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions test/ipld-bitcoin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const IPLDResolver = require('../src')
const buildBitcoinBlock = (header) => {
const block = new BitcoinBlock()
block.version = header.version || 0
block.prevHash = header.prevHash || Buffer.alloc(32)
block.merkleRoot = header.merkleRoot || Buffer.alloc(32)
block.prevHash = header.prevHash ? Buffer.from(header.prevHash) : Buffer.alloc(32)
block.merkleRoot = header.merkleRoot ? Buffer.from(header.merkleRoot) : Buffer.alloc(32)
block.timestamp = header.timestamp || 0
block.bits = header.bits || 0
block.nonce = header.nonce || 0
Expand Down

0 comments on commit 28ecc2f

Please sign in to comment.