Remove CWalletTx merging logic from AddToWallet
Summary:
Instead of AddToWallet taking a temporary CWalletTx object and then potentially
merging it with a pre-existing CWalletTx, have it take a callback so callers
can update the pre-existing CWalletTx directly.This makes AddToWallet simpler because now it is only has to be concerned with
saving CWalletTx objects and not merging them.This makes AddToWallet calls clearer because they can now make direct updates to
CWalletTx entries without having to make temporary objects and then worry about
how they will be merged.This is a pure refactoring, no behavior is changing.
This is a backport of Core PR9381 [1/5]
https://github.com/bitcoin/bitcoin/pull/9381/commits/2b9cba206594bfbcefcef0c88a0bf793819643bd
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9074