mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Merge bitcoin/bitcoin#23332: doc: Fix CWalletTx::Confirmation doc
fa8fef6ef2
doc: Fix CWalletTx::Confirmation doc (MarcoFalke) Pull request description: Follow-up to: * commit700c42b85d
, which replaced pIndex with block_hash in AddToWalletIfInvolvingMe. * commit9700fcb47f
, which replaced posInBlock with confirm.nIndex. ACKs for top commit: laanwj: Code review ACKfa8fef6ef2
ryanofsky: Code review ACKfa8fef6ef2
Tree-SHA512: e7643b8e9200b8ebab3eda30435ad77006568a03476006013c9ac42c826c84e42e29bcdefc6f443fe4d55e76e903bfed5aa7a51f831665001c204634b6f06508
This commit is contained in:
commit
af4275e8db
3 changed files with 8 additions and 9 deletions
|
@ -162,7 +162,8 @@ public:
|
|||
int block_height;
|
||||
uint256 hashBlock;
|
||||
int nIndex;
|
||||
Confirmation(Status s = UNCONFIRMED, int b = 0, uint256 h = uint256(), int i = 0) : status(s), block_height(b), hashBlock(h), nIndex(i) {}
|
||||
Confirmation(Status status = UNCONFIRMED, int block_height = 0, uint256 block_hash = uint256(), int block_index = 0)
|
||||
: status{status}, block_height{block_height}, hashBlock{block_hash}, nIndex{block_index} {}
|
||||
};
|
||||
|
||||
Confirmation m_confirm;
|
||||
|
|
|
@ -1212,7 +1212,7 @@ void CWallet::SyncTransaction(const CTransactionRef& ptx, CWalletTx::Confirmatio
|
|||
|
||||
void CWallet::transactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) {
|
||||
LOCK(cs_wallet);
|
||||
SyncTransaction(tx, {CWalletTx::Status::UNCONFIRMED, /* block height */ 0, /* block hash */ {}, /* index */ 0});
|
||||
SyncTransaction(tx, {CWalletTx::Status::UNCONFIRMED, /*block_height=*/0, /*block_hash=*/{}, /*block_index=*/0});
|
||||
|
||||
auto it = mapWallet.find(tx->GetHash());
|
||||
if (it != mapWallet.end()) {
|
||||
|
@ -1253,7 +1253,7 @@ void CWallet::transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRe
|
|||
// distinguishing between conflicted and unconfirmed transactions are
|
||||
// imperfect, and could be improved in general, see
|
||||
// https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Transaction-Conflict-Tracking
|
||||
SyncTransaction(tx, {CWalletTx::Status::UNCONFIRMED, /* block height */ 0, /* block hash */ {}, /* index */ 0});
|
||||
SyncTransaction(tx, {CWalletTx::Status::UNCONFIRMED, /*block_height=*/0, /*block_hash=*/{}, /*block_index=*/0});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ void CWallet::blockDisconnected(const CBlock& block, int height)
|
|||
m_last_block_processed_height = height - 1;
|
||||
m_last_block_processed = block.hashPrevBlock;
|
||||
for (const CTransactionRef& ptx : block.vtx) {
|
||||
SyncTransaction(ptx, {CWalletTx::Status::UNCONFIRMED, /* block height */ 0, /* block hash */ {}, /* index */ 0});
|
||||
SyncTransaction(ptx, {CWalletTx::Status::UNCONFIRMED, /*block_height=*/0, /*block_hash=*/{}, /*block_index=*/0});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -260,9 +260,9 @@ private:
|
|||
void AddToSpends(const uint256& wtxid, WalletBatch* batch = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/**
|
||||
* Add a transaction to the wallet, or update it. pIndex and posInBlock should
|
||||
* Add a transaction to the wallet, or update it. confirm.block_* should
|
||||
* be set when the transaction was known to be included in a block. When
|
||||
* pIndex == nullptr, then wallet state is not updated in AddToWallet, but
|
||||
* block_hash.IsNull(), then wallet state is not updated in AddToWallet, but
|
||||
* notifications happen and cached balances are marked dirty.
|
||||
*
|
||||
* If fUpdate is true, existing transactions will be updated.
|
||||
|
@ -270,7 +270,7 @@ private:
|
|||
* assumption that any further notification of a transaction that was considered
|
||||
* abandoned is an indication that it is not safe to be considered abandoned.
|
||||
* Abandoned state should probably be more carefully tracked via different
|
||||
* posInBlock signals or by checking mempool presence when necessary.
|
||||
* chain notifications or by checking mempool presence when necessary.
|
||||
*
|
||||
* Should be called with rescanning_old_block set to true, if the transaction is
|
||||
* not discovered in real time, but during a rescan of old blocks.
|
||||
|
@ -285,8 +285,6 @@ private:
|
|||
|
||||
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected/ScanForWalletTransactions.
|
||||
* Should be called with non-zero block_hash and posInBlock if this is for a transaction that is included in a block. */
|
||||
void SyncTransaction(const CTransactionRef& tx, CWalletTx::Confirmation confirm, bool update_tx = true, bool rescanning_old_block = false) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/** WalletFlags set on this wallet. */
|
||||
|
|
Loading…
Add table
Reference in a new issue