You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on a minimal rewrite for our remaining usage of boost::signals2 (POC branch here), I stumbled upon some undocumented/undefined behavior with our current usage.
On my WIP replacement branch I implemented it by chaining the calls as suggested (and as-intended in our code): https://github.com/theuni/bitcoin/blob/replace-boost-signals/src/btcsignals.h#L140 . This makes tests happy, so presumably that's what's going on with boost too, though there are details (like interim disconnections) which could give us trouble in the future.
Regardless of the fact that this works for now, I don't think that we should be relying on it. I haven't looked into the details, but I'm hoping it could be fixed with some simple stub functions.
CWallet itself does not actually need to have these signals itself, they really are just passthrough from the SPKMs. The exception is a few places where CWallet is doing something with a SPKM and needs to emit NotifyCanGetAddressesChanged, but it could just call the signal in the SPKM it's working on in order to do that instead of having it's own signal. So the obvious solution here would be to connect to the SPKM signals directly instead of CWallet's, and remove the signals from CWallet entirely. This could be done with a helper (perhaps modifying ConnectScriptPubKeyManNotifiers?), although perhaps there might be issues with connecting the signal for SPKMs that are created afterwards.
although perhaps there might be issues with connecting the signal for SPKMs that are created afterwards.
The wallet could trigger a signal on every added SPKM. e.g. trigger NewScriptPubKeyMan(const uint256& id) so the GUI subscribes to it calling ConnectScriptPubKeyMan(const uint256& id, callback).
Still, have to say that I'm not so convinced about it. Independently from boost's problem, I think that, layers division wise, the spkm signal should first pass through the wallet, which could perform some operations with it (update/refresh some state/cache), and then the wallet trigger the upper layers signal (or call a function in a signals dispatcher object like we do in the validation area).
While working on a minimal rewrite for our remaining usage of
boost::signals2
(POC branch here), I stumbled upon some undocumented/undefined behavior with our current usage.Specifically the problem, introduced in #17261, is that signals aren't intended to connect to other signals. Currently this is violated in the wallet: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L3518
See the boost discussion here: https://groups.google.com/g/boost-list/c/So4i8JXneJ0
On my WIP replacement branch I implemented it by chaining the calls as suggested (and as-intended in our code):
https://github.com/theuni/bitcoin/blob/replace-boost-signals/src/btcsignals.h#L140 . This makes tests happy, so presumably that's what's going on with boost too, though there are details (like interim disconnections) which could give us trouble in the future.
Regardless of the fact that this works for now, I don't think that we should be relying on it. I haven't looked into the details, but I'm hoping it could be fixed with some simple stub functions.
Ping @achow101. Any easy/obvious workarounds?
The text was updated successfully, but these errors were encountered: