Broken out from #28201
In order to estimate fees properly, we need to know what the final serialized transaction size will be. This PR refactors CreateTransactionInternal
to:
- Get the serialized size directly from the
CRecipient
: this sets us up in a future PR to calculate the serialized size of silent paymentCTxDestinations
(see https://github.com/bitcoin/bitcoin/pull/28201/commits/797e21c8c1bf393e668eeef8bb7ee9cae1e5e41e) - Use the new
GetSerializeSizeForRecipient
to move the serialize size calculation to before coin selection and the output creation to after coin selection: this also sets us up for silent payments sending in a future PR in that silent payments outputs cannot be created until after the inputs to the transaction have been selected
Aside from the silent payments use case, I think this structure logically makes more sense. As a reminder, move-only commits are best reviewed with something like git diff -w --color-moved=dimmed-zebra