In commit “wallet: introduce generic recursive tx state updating function” (f998cdbc689cc65ff0aca98ce63758c59786c1db)
I think that this is a good idea, but would out of the scope of this PR and would warrant more discussion, since then it would be notifying for tx state updates that it previously did not.
Agree we should avoid changing behavior, but I think the current commit might also be changing behavior by notifying before calling MarkDirty and WriteTx instead of after.
I think the best thing to do would be to change TryUpdatingStateFn to return an enum instead of a bool like:
0enum class TxUpdate { UNCHANGED, CHANGED, NOTIFY_CHANGED };
1using TryUpdatingStateFn = std::function<TxUpdate(CWalletTx& wtx)>;
Returning CHANGED/UNCHANGED should make the code clearer anyway because it’s less obvious what true and false mean.