mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-03 16:02:34 +02:00
wallet: add IsTxAssumed() to WalletTxStatus
Determine if a given transaction belongs to a block that is assumed to be valid pending background validation. Add this information to WalletTxStatus. Github-Pull: #28616 Rebased-From: a6c53bb24436ecc1ae717b032c0cccdd704044eb
This commit is contained in:
parent
2904c57bc4
commit
d8a448249a
@ -426,6 +426,8 @@ struct WalletTxStatus
|
||||
bool is_abandoned;
|
||||
bool is_coinbase;
|
||||
bool is_in_main_chain;
|
||||
// The block containing this transaction is assumed valid
|
||||
bool is_assumed;
|
||||
};
|
||||
|
||||
//! Wallet transaction output.
|
||||
|
@ -104,6 +104,7 @@ WalletTxStatus MakeWalletTxStatus(const CWallet& wallet, const CWalletTx& wtx)
|
||||
result.is_abandoned = wtx.isAbandoned();
|
||||
result.is_coinbase = wtx.IsCoinBase();
|
||||
result.is_in_main_chain = wtx.isConfirmed();
|
||||
result.is_assumed = wallet.IsTxAssumed(wtx);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3473,6 +3473,18 @@ bool CWallet::IsTxImmatureCoinBase(const CWalletTx& wtx) const
|
||||
return GetTxBlocksToMaturity(wtx) > 0;
|
||||
}
|
||||
|
||||
bool CWallet::IsTxAssumed(const CWalletTx& wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
if (GetBackgroundValidationHeight() == -1) return false;
|
||||
if (auto* conf = wtx.state<TxStateConfirmed>()) {
|
||||
int height{conf->confirmed_block_height};
|
||||
return height > GetBackgroundValidationHeight();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CWallet::IsCrypted() const
|
||||
{
|
||||
return HasEncryptionKeys();
|
||||
|
@ -525,6 +525,7 @@ public:
|
||||
* referenced in transaction, and might cause assert failures.
|
||||
*/
|
||||
int GetTxDepthInMainChain(const CWalletTx& wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
bool IsTxAssumed(const CWalletTx& wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/**
|
||||
* @return number of blocks to maturity for this transaction:
|
||||
|
Loading…
Reference in New Issue
Block a user