Page MenuHomePhabricator

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

Authored by majcosta on Mon, Jul 27, 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

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 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