Changeset View
Changeset View
Standalone View
Standalone View
src/undo.h
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public: | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
inline void SerializationOp(Stream &s, Operation ser_action) { | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
READWRITE(vtxundo); | READWRITE(vtxundo); | ||||
} | } | ||||
}; | }; | ||||
/** Apply the undo operation of a CTxInUndo to the given chain state. */ | enum DisconnectResult { | ||||
bool ApplyTxInUndo(const CTxInUndo &undo, CCoinsViewCache &view, | // All good. | ||||
DISCONNECT_OK, | |||||
// Rolled back, but UTXO set was inconsistent with block. | |||||
DISCONNECT_UNCLEAN, | |||||
// Something else went wrong. | |||||
DISCONNECT_FAILED, | |||||
}; | |||||
/** | |||||
* Apply the undo operation of a CTxInUndo to the given chain state. | |||||
* @param undo The undo object. | |||||
* @param view The coins view to which to apply the changes. | |||||
* @param out The out point that corresponds to the tx input. | |||||
* @return A DisconnectResult | |||||
*/ | |||||
DisconnectResult ApplyTxInUndo(const CTxInUndo &undo, CCoinsViewCache &view, | |||||
const COutPoint &out); | const COutPoint &out); | ||||
/** Undo a block from the block and the undoblock data. | /** | ||||
* See DisconnectBlock for more details. */ | * Undo a block from the block and the undoblock data. | ||||
bool ApplyBlockUndo(const CBlock &block, CValidationState &state, | * See DisconnectBlock for more details. | ||||
const CBlockIndex *pindex, CCoinsViewCache &coins, | */ | ||||
const CBlockUndo &blockUndo, bool *pfClean = nullptr); | DisconnectResult ApplyBlockUndo(const CBlockUndo &blockUndo, | ||||
const CBlock &block, const CBlockIndex *pindex, | |||||
CCoinsViewCache &coins); | |||||
#endif // BITCOIN_UNDO_H | #endif // BITCOIN_UNDO_H |