Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,343 Lines • ▼ Show 20 Lines | if (undo.GetHeight() == 0) { | ||||
// This is somewhat ugly, but hopefully utility is limited. This is only | // This is somewhat ugly, but hopefully utility is limited. This is only | ||||
// useful when working from legacy on disck data. In any case, putting | // useful when working from legacy on disck data. In any case, putting | ||||
// the correct information in there doesn't hurt. | // the correct information in there doesn't hurt. | ||||
const_cast<Coin &>(undo) = Coin(undo.GetTxOut(), alternate.GetHeight(), | const_cast<Coin &>(undo) = Coin(undo.GetTxOut(), alternate.GetHeight(), | ||||
alternate.IsCoinBase()); | alternate.IsCoinBase()); | ||||
} | } | ||||
// The potential_overwrite parameter to AddCoin is only allowed to be false | // If the coin already exists as an unspent coin in the cache, then the | ||||
// if we know for sure that the coin did not already exist in the cache. As | // possible_overwrite parameter to AddCoin must be set to true. We have | ||||
// we have queried for that above using HaveCoin, we don't need to guess. | // already checked whether an unspent coin exists above using HaveCoin, so | ||||
// When fClean is false, a coin already existed and it is an overwrite. | // we don't need to guess. When fClean is false, an unspent coin already | ||||
// existed and it is an overwrite. | |||||
view.AddCoin(out, std::move(undo), !fClean); | view.AddCoin(out, std::move(undo), !fClean); | ||||
return fClean ? DisconnectResult::OK : DisconnectResult::UNCLEAN; | return fClean ? DisconnectResult::OK : DisconnectResult::UNCLEAN; | ||||
} | } | ||||
/** | /** | ||||
* Undo the effects of this block (with given index) on the UTXO set represented | * Undo the effects of this block (with given index) on the UTXO set represented | ||||
* by coins. When FAILED is returned, view is left in an indeterminate state. | * by coins. When FAILED is returned, view is left in an indeterminate state. | ||||
▲ Show 20 Lines • Show All 4,674 Lines • Show Last 20 Lines |