Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.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) 2018 The Bitcoin developers | // Copyright (c) 2018 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_WALLET_WALLET_H | #ifndef BITCOIN_WALLET_WALLET_H | ||||
#define BITCOIN_WALLET_WALLET_H | #define BITCOIN_WALLET_WALLET_H | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <outputtype.h> | #include <outputtype.h> | ||||
#include <primitives/blockhash.h> | |||||
#include <script/ismine.h> | #include <script/ismine.h> | ||||
#include <script/sign.h> | #include <script/sign.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | struct COutputEntry { | ||||
Amount amount; | Amount amount; | ||||
int vout; | int vout; | ||||
}; | }; | ||||
/** A transaction with a merkle branch linking it to the block chain. */ | /** A transaction with a merkle branch linking it to the block chain. */ | ||||
class CMerkleTx { | class CMerkleTx { | ||||
private: | private: | ||||
/** Constant used in hashBlock to indicate tx has been abandoned */ | /** Constant used in hashBlock to indicate tx has been abandoned */ | ||||
static const uint256 ABANDON_HASH; | static const BlockHash ABANDON_HASH; | ||||
public: | public: | ||||
CTransactionRef tx; | CTransactionRef tx; | ||||
uint256 hashBlock; | BlockHash hashBlock; | ||||
/** | /** | ||||
* An nIndex == -1 means that hashBlock (in nonzero) refers to the earliest | * An nIndex == -1 means that hashBlock (in nonzero) refers to the earliest | ||||
* block in the chain we know this or any in-wallet dependency conflicts | * block in the chain we know this or any in-wallet dependency conflicts | ||||
* with. Older clients interpret nIndex == -1 as unconfirmed for backward | * with. Older clients interpret nIndex == -1 as unconfirmed for backward | ||||
* compatibility. | * compatibility. | ||||
*/ | */ | ||||
int nIndex; | int nIndex; | ||||
CMerkleTx() { | CMerkleTx() { | ||||
SetTx(MakeTransactionRef()); | SetTx(MakeTransactionRef()); | ||||
Init(); | Init(); | ||||
} | } | ||||
explicit CMerkleTx(CTransactionRef arg) { | explicit CMerkleTx(CTransactionRef arg) { | ||||
SetTx(std::move(arg)); | SetTx(std::move(arg)); | ||||
Init(); | Init(); | ||||
} | } | ||||
void Init() { | void Init() { | ||||
hashBlock = uint256(); | hashBlock = BlockHash(); | ||||
nIndex = -1; | nIndex = -1; | ||||
} | } | ||||
void SetTx(CTransactionRef arg) { tx = std::move(arg); } | void SetTx(CTransactionRef arg) { tx = std::move(arg); } | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
▲ Show 20 Lines • Show All 487 Lines • ▼ Show 20 Lines | private: | ||||
TxSpends mapTxSpends; | TxSpends mapTxSpends; | ||||
void AddToSpends(const COutPoint &outpoint, const TxId &wtxid); | void AddToSpends(const COutPoint &outpoint, const TxId &wtxid); | ||||
void AddToSpends(const TxId &wtxid); | void AddToSpends(const TxId &wtxid); | ||||
/** | /** | ||||
* Mark a transaction (and its in-wallet descendants) as conflicting with a | * Mark a transaction (and its in-wallet descendants) as conflicting with a | ||||
* particular block. | * particular block. | ||||
*/ | */ | ||||
void MarkConflicted(const uint256 &hashBlock, const TxId &txid); | void MarkConflicted(const BlockHash &hashBlock, const TxId &txid); | ||||
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>); | void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>); | ||||
/** | /** | ||||
* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected. | * Used by TransactionAddedToMemorypool/BlockConnected/Disconnected. | ||||
* Should be called with pindexBlock and posInBlock if this is for a | * Should be called with pindexBlock and posInBlock if this is for a | ||||
* transaction that is included in a block. | * transaction that is included in a block. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 730 Lines • Show Last 20 Lines |