MCPcopy Create free account
hub / github.com/ElementsProject/elements / CheckPeginRipeness

Function CheckPeginRipeness

src/validation.cpp:2064–2085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2062static int64_t nBlocksTotal = 0;
2063
2064bool CheckPeginRipeness(const CBlock& block, const std::vector<std::pair<CScript, CScript>>& fedpegscripts) {
2065 for (unsigned int i = 0; i < block.vtx.size(); i++) {
2066 const CTransaction &tx = *(block.vtx[i]);
2067
2068 if (!tx.IsCoinBase()) {
2069 for (unsigned int i = 0; i < tx.vin.size(); ++i) {
2070 if (tx.vin[i].m_is_pegin) {
2071 std::string err;
2072 bool depth_failed = false;
2073 if ((tx.witness.vtxinwit.size() <= i) || !IsValidPeginWitness(tx.witness.vtxinwit[i].m_pegin_witness, fedpegscripts, tx.vin[i].prevout, err, true, &depth_failed)) {
2074 if (depth_failed) {
2075 return false; // Pegins not ripe.
2076 } else {
2077 return true; // Some other failure; details later.
2078 }
2079 }
2080 }
2081 }
2082 }
2083 }
2084 return true;
2085}
2086
2087/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
2088 * Validity checks that depend on the UTXO set are also done; ConnectBlock()

Callers 1

ConnectTipMethod · 0.85

Calls 3

IsValidPeginWitnessFunction · 0.85
sizeMethod · 0.45
IsCoinBaseMethod · 0.45

Tested by

no test coverage detected