Apply the effects of a block on the utxo cache, ignoring that it may already have been applied. */
| 4326 | |
| 4327 | /** Apply the effects of a block on the utxo cache, ignoring that it may already have been applied. */ |
| 4328 | bool CChainState::RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& inputs, const CChainParams& params) |
| 4329 | { |
| 4330 | // TODO: merge with ConnectBlock |
| 4331 | CBlock block; |
| 4332 | if (!ReadBlockFromDisk(block, pindex, params.GetConsensus())) { |
| 4333 | return error("ReplayBlock(): ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); |
| 4334 | } |
| 4335 | |
| 4336 | for (const CTransactionRef& tx : block.vtx) { |
| 4337 | if (!tx->IsCoinBase()) { |
| 4338 | for (const CTxIn &txin : tx->vin) { |
| 4339 | inputs.SpendCoin(txin.prevout); |
| 4340 | } |
| 4341 | } |
| 4342 | // Pass check = true as every addition may be an overwrite. |
| 4343 | AddCoins(inputs, *tx, pindex->nHeight, true); |
| 4344 | } |
| 4345 | return true; |
| 4346 | } |
| 4347 | |
| 4348 | bool CChainState::ReplayBlocks(const CChainParams& params, CCoinsView* view) |
| 4349 | { |
nothing calls this directly
no test coverage detected