Changeset View
Changeset View
Standalone View
Standalone View
src/undo.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Copyright (c) 2017-2019 The Bitcoin developers | // Copyright (c) 2017-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_UNDO_H | #ifndef BITCOIN_UNDO_H | ||||
#define BITCOIN_UNDO_H | #define BITCOIN_UNDO_H | ||||
#include <coins.h> | #include <coins.h> | ||||
#include <compressor.h> | #include <compressor.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <disconnectresult.h> | |||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <version.h> | #include <version.h> | ||||
class CBlock; | class CBlock; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CCoinsViewCache; | class CCoinsViewCache; | ||||
class CValidationState; | class CValidationState; | ||||
▲ Show 20 Lines • Show All 89 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); | ||||
} | } | ||||
}; | }; | ||||
enum DisconnectResult { | |||||
// All good. | |||||
DISCONNECT_OK, | |||||
// Rolled back, but UTXO set was inconsistent with block. | |||||
DISCONNECT_UNCLEAN, | |||||
// Something else went wrong. | |||||
DISCONNECT_FAILED, | |||||
}; | |||||
/** | /** | ||||
* Restore the UTXO in a Coin at a given COutPoint. | * Restore the UTXO in a Coin at a given COutPoint. | ||||
* @param undo The Coin to be restored. | * @param undo The Coin to be restored. | ||||
* @param view The coins view to which to apply the changes. | * @param view The coins view to which to apply the changes. | ||||
* @param out The out point that corresponds to the tx input. | * @param out The out point that corresponds to the tx input. | ||||
* @return A DisconnectResult | * @return A DisconnectResult | ||||
*/ | */ | ||||
DisconnectResult UndoCoinSpend(const Coin &undo, CCoinsViewCache &view, | DisconnectResult UndoCoinSpend(const Coin &undo, CCoinsViewCache &view, | ||||
Show All 11 Lines |