Merge #11864: Make CWallet::FundTransaction atomic
Summary:
03a5dc9 [wallet] Make CWallet::FundTransaction atomic (João Barbosa)
Pull request description:
This PR fixes a race for `setLockedCoins` when `lockUnspents` is true. For instance, it should not be possible to use the same unspent in concurrent `fundrawtransaction` calls. Now the `cs_main` and `cs_wallet` locks are held during `CreateTransaction` and `LockCoin`(s). Also added some style nits around the change.
Tree-SHA512: ccf383c0c5f6db775655a3e9ccd200c3bd831a83afae2b7c389564c74f7227f5bea86a4775727de2c3603b188f383f8a12d3f9d6d94f7887865c31c94ce95ef6
Part 2 of 2 of Core PR11864
https://github.com/bitcoin/bitcoin/pull/11864/commits/03a5dc9c3c522c500c77fdecd52d091db048d1b0
Commit:
Make CWallet::FundTransaction atomic 03a5dc9c3c522c500c77fdecd52d091db048d1b0
Depends on D3192
Test Plan:
make check test_runner.py
Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc
Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D3196