Apply the effects of a block on the utxo cache, ignoring that it may already have been applied. */
| 4418 | |
| 4419 | /** Apply the effects of a block on the utxo cache, ignoring that it may already have been applied. */ |
| 4420 | bool CChainState::RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& inputs) |
| 4421 | { |
| 4422 | AssertLockHeld(cs_main); |
| 4423 | // TODO: merge with ConnectBlock |
| 4424 | CBlock block; |
| 4425 | if (!ReadBlockFromDisk(block, pindex, m_params.GetConsensus())) { |
| 4426 | return error("ReplayBlock(): ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); |
| 4427 | } |
| 4428 | |
| 4429 | for (const CTransactionRef& tx : block.vtx) { |
| 4430 | if (!tx->IsCoinBase()) { |
| 4431 | for (const CTxIn &txin : tx->vin) { |
| 4432 | inputs.SpendCoin(txin.prevout); |
| 4433 | } |
| 4434 | } |
| 4435 | // Pass check = true as every addition may be an overwrite. |
| 4436 | AddCoins(inputs, *tx, pindex->nHeight, true); |
| 4437 | } |
| 4438 | return true; |
| 4439 | } |
| 4440 | |
| 4441 | bool CChainState::ReplayBlocks() |
| 4442 | { |
nothing calls this directly
no test coverage detected