Page MenuHomePhabricator

[wallet] Remove locked_chain from CWallet, its RPCs and tests
ClosedPublic

Authored by deadalnix on Thu, Oct 15, 14:54.

Details

Summary

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.

Backport of Core PR16426 part [5/5] : https://github.com/bitcoin/bitcoin/pull/16426/commits/6a72f26968cf931c985d8d4797b6264274cabd06

Depends on D7937

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

majcosta requested changes to this revision.Thu, Oct 15, 17:27
majcosta added a subscriber: majcosta.
majcosta added inline comments.
src/wallet/test/wallet_tests.cpp
632 ↗(On Diff #24663)

There's a pretty big out of order backport gap after this.

Maybe creating a task/reminder to revisit this PR after 18115 and 18727 are landed is a good idea.

This revision now requires changes to proceed.Thu, Oct 15, 17:27
deadalnix added inline comments.
src/wallet/test/wallet_tests.cpp
632 ↗(On Diff #24663)

It's fine these will be compile errors.

This revision is now accepted and ready to land.Thu, Oct 15, 22:01