Page MenuHomePhabricator

[backport#16624 3/4] Modify wallet tx status if has been reorged out
ClosedPublic

Authored by majcosta on Jul 27 2020, 19:20.

Details

Summary

Add a LockChain method to CWallet to know if we can lock or query
chain state safely.

At tx loading, we rely on chain to know if hashBlock of tx is still
in main chain. If not, we set its status to unconfirmed and reset
its hashBlock/nIndex.

If wallet loaded is the wallet-tool one, all wallet txn will
show up with a height of zero. It doesn't matter as status is not
used by wallet-tool.

We take lock prematurely in CWallet::LoadWallet and CWallet::Verify
to ensure that lock order is respected between cs_main an cs_wallet.

https://github.com/bitcoin/bitcoin/pull/16624/commits/40ede992d97df38282919693dfe851c975c3b1d8


Depends on D7049

Partial backport of Core PR16624

Test Plan
ninja check check-functional

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

This revision is now accepted and ready to land.Jul 28 2020, 09:17