HomePhabricator

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

Description

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

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D7050

Details

Provenance
Antoine Riard <ariard@student.42.fr>Authored on Aug 22 2019, 17:16
majcostaCommitted on Jul 28 2020, 11:04
majcostaPushed on Jul 28 2020, 11:04
Reviewer
Restricted Project
Differential Revision
D7050: [backport#16624 3/4] Modify wallet tx status if has been reorged out
Parents
rABC78c6a6547d2d: [backport#16624 2/4] Remove SyncTransaction for conflicted txn in CWallet…
Branches
Unknown
Tags
Unknown