Page MenuHomePhabricator

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

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



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.

Depends on D7049

Partial backport of Core PR16624

Test Plan
ninja check check-functional

Diff Detail

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

Event Timeline

majcosta created this revision.Mon, Jul 27, 19:20
Herald added a reviewer: Restricted Project. · View Herald TranscriptMon, Jul 27, 19:20
teamcity edited the summary of this revision. (Show Details)Mon, Jul 27, 21:56

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

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