mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-24 22:45:41 +01:00
[wallet] Remove locked_chain from CWallet, its RPCs and tests
This change is intended to make the bitcoin node and its rpc, network and gui interfaces more responsive while the wallet is in use. Currently because the node's cs_main mutex is always locked before the wallet's cs_wallet mutex (to prevent deadlocks), cs_main currently stays locked while the wallet does relatively slow things like creating and listing transactions. This commit only remmove chain lock tacking in wallet code, and invert lock order from cs_main, cs_wallet to cs_wallet, cs_main. must happen at once to avoid any deadlock. Previous commit were only removing Chain::Lock methods to Chain interface and enforcing they take cs_main. Remove LockChain method from CWallet and Chain::Lock interface.
This commit is contained in:
@@ -53,11 +53,6 @@ bool FillBlock(const CBlockIndex* index, const FoundBlock& block, UniqueLock<Rec
|
||||
return true;
|
||||
}
|
||||
|
||||
class LockImpl : public Chain::Lock, public UniqueLock<RecursiveMutex>
|
||||
{
|
||||
using UniqueLock::UniqueLock;
|
||||
};
|
||||
|
||||
class NotificationsProxy : public CValidationInterface
|
||||
{
|
||||
public:
|
||||
@@ -150,13 +145,6 @@ class ChainImpl : public Chain
|
||||
{
|
||||
public:
|
||||
explicit ChainImpl(NodeContext& node) : m_node(node) {}
|
||||
std::unique_ptr<Chain::Lock> lock(bool try_lock) override
|
||||
{
|
||||
auto lock = MakeUnique<LockImpl>(::cs_main, "cs_main", __FILE__, __LINE__, try_lock);
|
||||
if (try_lock && lock && !*lock) return {};
|
||||
std::unique_ptr<Chain::Lock> result = std::move(lock); // Temporary to avoid CWG 1579
|
||||
return result;
|
||||
}
|
||||
Optional<int> getHeight() override
|
||||
{
|
||||
LOCK(::cs_main);
|
||||
|
||||
Reference in New Issue
Block a user