MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetWitnessCommitmentIndex

Function GetWitnessCommitmentIndex

src/main.cpp:2151–2162  ·  view source on GitHub ↗

Compute at which vout of the block's coinbase transaction the witness commitment occurs, or -1 if not found.

Source from the content-addressed store, hash-verified

2149// Compute at which vout of the block's coinbase transaction the witness
2150// commitment occurs, or -1 if not found.
2151static int GetWitnessCommitmentIndex(const CBlock& block)
2152{
2153 int commitpos = -1;
2154 if (!block.vtx.empty()) {
2155 for (size_t o = 0; o < block.vtx[0].vout.size(); o++) {
2156 if (block.vtx[0].vout[o].scriptPubKey.size() >= 38 && block.vtx[0].vout[o].scriptPubKey[0] == OP_RETURN && block.vtx[0].vout[o].scriptPubKey[1] == 0x24 && block.vtx[0].vout[o].scriptPubKey[2] == 0xaa && block.vtx[0].vout[o].scriptPubKey[3] == 0x21 && block.vtx[0].vout[o].scriptPubKey[4] == 0xa9 && block.vtx[0].vout[o].scriptPubKey[5] == 0xed) {
2157 commitpos = o;
2158 }
2159 }
2160 }
2161 return commitpos;
2162}
2163
2164void static InvalidBlockFound(CBlockIndex* pindex, const CValidationState& state)
2165{

Callers 4

CheckBlockFunction · 0.85
ContextualCheckBlockFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected