mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-04-14 23:09:26 +02:00
update witness commit
This commit is contained in:
parent
e6e51dd673
commit
4b4b04a52c
@ -105,6 +105,11 @@ export class MiningJob {
|
||||
testBlock.merkleRoot = this.calculateMerkleRootHash(testBlock.transactions[0].getHash(false), this.merkle_branch);
|
||||
testBlock.witnessCommit = bitcoinjs.Block.calculateMerkleRoot(this.block.transactions, true);
|
||||
|
||||
const segwitMagicBits = Buffer.from('aa21a9ed', 'hex');
|
||||
// 32-byte - Commitment hash: Double-SHA256(witness root hash|witness reserved value)
|
||||
const commitmentHash = this.sha256(this.sha256(Buffer.concat([testBlock.witnessCommit, testBlock.transactions[0].ins[0].witness[0]])));
|
||||
testBlock.transactions[0].outs[testBlock.transactions[0].outs.length - 1].script = bitcoinjs.script.compile([bitcoinjs.opcodes.OP_RETURN, Buffer.concat([segwitMagicBits, commitmentHash])])
|
||||
|
||||
testBlock.timestamp = timestamp;
|
||||
|
||||
return testBlock;
|
||||
|
Loading…
x
Reference in New Issue
Block a user