mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge #17354: wallet: Tidy CWallet::SetUsedDestinationState
0b75a7f068wallet: Reuse existing batch in CWallet::SetUsedDestinationState (João Barbosa)01f45dd00ewallet: Avoid recursive lock in CWallet::SetUsedDestinationState (João Barbosa) Pull request description: This PR makes 2 distinct changes around `CWallet::SetUsedDestinationState`: - 1st the recursive lock is removed and now it requires the lock to be held; - 2nd change is to support, in the best case, just a wallet database flush when transaction is added to the wallet. ACKs for top commit: achow101: ACK0b75a7f068MarcoFalke: ACK0b75a7f068ryanofsky: Code review ACK0b75a7f068. Code changes looks fine but PR description should be updated to say what benefits of the change are. I might have missed something, but I didn't see a place where multiple batches were used previously and a single batch was used now. So the main benefit of this change appears to be removing a recursive lock? And maybe moving toward a consistent convention for passing batch instances? Tree-SHA512: abcf23a5850d29990668db20d6f624cca3e89629cc9ed003e0d05cde1b58ab2ff365034f156684ad13e55764b54c6c0c2bc7d5f96b8af7dc5e45a3be955d6b15
This commit is contained in:
@@ -357,9 +357,10 @@ BOOST_AUTO_TEST_CASE(LoadReceiveRequests)
|
||||
{
|
||||
CTxDestination dest = PKHash();
|
||||
LOCK(m_wallet.cs_wallet);
|
||||
m_wallet.AddDestData(dest, "misc", "val_misc");
|
||||
m_wallet.AddDestData(dest, "rr0", "val_rr0");
|
||||
m_wallet.AddDestData(dest, "rr1", "val_rr1");
|
||||
WalletBatch batch{m_wallet.GetDatabase()};
|
||||
m_wallet.AddDestData(batch, dest, "misc", "val_misc");
|
||||
m_wallet.AddDestData(batch, dest, "rr0", "val_rr0");
|
||||
m_wallet.AddDestData(batch, dest, "rr1", "val_rr1");
|
||||
|
||||
auto values = m_wallet.GetDestValues("rr");
|
||||
BOOST_CHECK_EQUAL(values.size(), 2U);
|
||||
|
||||
Reference in New Issue
Block a user