HomePhabricator

wallet: Reset chain notifications handler if AttachChain fails

Description

wallet: Reset chain notifications handler if AttachChain fails

Summary:

AttachChain will create the chain notifications handler which contains a
reference to the wallet's shared_ptr. If AttachChain fails, the wallet
needs to be unloaded, and this is expected to happen with its custom
deleter ReleaseWallet. However, if the chain notifications handler is
still set, then the shared_ptr is still referenced by something, so the
wallet is never actually released.

Backport of core#29243.

Depends on D17981.

This fixes the ASAN failure from the wallet_assumeutxo functional test.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
Ava Chow <github@achow101.com>Authored on Jan 13 2024, 01:07
FabienCommitted on Wed, Apr 23, 18:49
teamcityPushed on Wed, Apr 23, 18:54
Parents
rSTAGINGed9647a09ffb: wallet: Postpone wallet loading notification for encrypted wallets
Branches
Unknown
Tags
Unknown

Event Timeline