Addresses #9362
Right now, fundrawtransaction
does get a CReserveKey
from the keypool, but either a “return” nor a “keep key” is called on that reserve key. This results in most cases in address reuse. Calling getnewaddress()
will return the identical key just used as change in fundrawtransaction
.
The only possible solution for now is to call getrawchangeaddress
and pass the change address to the fundrawtransaction
options.
This PR does loop through all outputs of new wallet transactions and compares them against the keypool and – if there is a match – remove the key from the keypool.
Not sure how good this performs on large wallets doing a rescan.
Be aware that the most line-changes are moveonly (CAffectedKeysVisitor, check first commit).