MCPcopy
hub / github.com/bcoin-org/bcoin / fromCommitment

Method fromCommitment

lib/script/script.js:1657–1671  ·  view source on GitHub ↗

* Inject properties from a witness block commitment. * @private * @param {Buffer} hash * @param {String|Buffer} flags

(hash, flags)

Source from the content-addressed store, hash-verified

1655 */
1656
1657 fromCommitment(hash, flags) {
1658 const bw = bio.write(36);
1659
1660 bw.writeU32BE(0xaa21a9ed);
1661 bw.writeHash(hash);
1662
1663 this.clear();
1664 this.pushOp(opcodes.OP_RETURN);
1665 this.pushData(bw.render());
1666
1667 if (flags)
1668 this.pushData(flags);
1669
1670 return this.compile();
1671 }
1672
1673 /**
1674 * Create a witness block commitment.

Callers 2

getWitnessScriptMethod · 0.80
createCoinbaseMethod · 0.80

Calls 6

clearMethod · 0.95
pushOpMethod · 0.95
pushDataMethod · 0.95
compileMethod · 0.95
renderMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected