mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 14:19:59 -05:00
Add proper thread safety annotation to CWallet::GetTxConflicts()
This commit is contained in:
parent
ca446f2c59
commit
8cfe93e3fc
3 changed files with 7 additions and 13 deletions
|
@ -15,6 +15,7 @@ using interfaces::FoundBlock;
|
||||||
|
|
||||||
namespace wallet {
|
namespace wallet {
|
||||||
static void WalletTxToJSON(const CWallet& wallet, const CWalletTx& wtx, UniValue& entry)
|
static void WalletTxToJSON(const CWallet& wallet, const CWalletTx& wtx, UniValue& entry)
|
||||||
|
EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
|
||||||
{
|
{
|
||||||
interfaces::Chain& chain = wallet.chain();
|
interfaces::Chain& chain = wallet.chain();
|
||||||
int confirms = wallet.GetTxDepthInMainChain(wtx);
|
int confirms = wallet.GetTxDepthInMainChain(wtx);
|
||||||
|
|
|
@ -1869,12 +1869,11 @@ bool CWallet::SubmitTxMemoryPoolAndRelay(CWalletTx& wtx, std::string& err_string
|
||||||
|
|
||||||
std::set<uint256> CWallet::GetTxConflicts(const CWalletTx& wtx) const
|
std::set<uint256> CWallet::GetTxConflicts(const CWalletTx& wtx) const
|
||||||
{
|
{
|
||||||
std::set<uint256> result;
|
AssertLockHeld(cs_wallet);
|
||||||
{
|
|
||||||
uint256 myHash = wtx.GetHash();
|
const uint256 myHash{wtx.GetHash()};
|
||||||
result = GetConflicts(myHash);
|
std::set<uint256> result{GetConflicts(myHash)};
|
||||||
result.erase(myHash);
|
result.erase(myHash);
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,13 +415,7 @@ public:
|
||||||
|
|
||||||
const CWalletTx* GetWalletTx(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
const CWalletTx* GetWalletTx(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
|
|
||||||
// TODO: Remove "NO_THREAD_SAFETY_ANALYSIS" and replace it with the correct
|
std::set<uint256> GetTxConflicts(const CWalletTx& wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
// annotation "EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)". The annotation
|
|
||||||
// "NO_THREAD_SAFETY_ANALYSIS" was temporarily added to avoid having to
|
|
||||||
// resolve the issue of member access into incomplete type CWallet. Note
|
|
||||||
// that we still have the runtime check "AssertLockHeld(pwallet->cs_wallet)"
|
|
||||||
// in place.
|
|
||||||
std::set<uint256> GetTxConflicts(const CWalletTx& wtx) const NO_THREAD_SAFETY_ANALYSIS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return depth of transaction in blockchain:
|
* Return depth of transaction in blockchain:
|
||||||
|
|
Loading…
Add table
Reference in a new issue