From a1d8590055a05ffbbef70bf5ce1a94ec276cc7d6 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Fri, 23 Jun 2023 16:00:25 -0400 Subject: [PATCH] rename --- src/models/MiningJob.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/MiningJob.ts b/src/models/MiningJob.ts index 0496740..4c6f341 100644 --- a/src/models/MiningJob.ts +++ b/src/models/MiningJob.ts @@ -60,9 +60,9 @@ export class MiningJob { // 4-byte - Commitment header (0xaa21a9ed) const segwitMagicBits = Buffer.from('aa21a9ed', 'hex'); // 32-byte - Commitment hash: Double-SHA256(witness root hash|witness reserved value) - const merkleRoot = this.sha256(this.sha256(witnessRootHash)); + const commitmentHash = this.sha256(this.sha256(witnessRootHash)); // 39th byte onwards: Optional data with no consensus meaning - this.coinbaseTransaction.outs[0].script = bitcoinjs.script.compile([bitcoinjs.opcodes.OP_RETURN, Buffer.concat([segwitMagicBits, merkleRoot])]); + this.coinbaseTransaction.outs[0].script = bitcoinjs.script.compile([bitcoinjs.opcodes.OP_RETURN, Buffer.concat([segwitMagicBits, commitmentHash])]); //@ts-ignore const serializedTx = this.coinbaseTransaction.__toBuffer().toString('hex');