]> Untitled Git - bdk/commit
Calculate fee amount after output addition
authorDaniela Brozzoni <danielabrozzoni@protonmail.com>
Mon, 11 Jul 2022 19:52:11 +0000 (21:52 +0200)
committerDaniela Brozzoni <danielabrozzoni@protonmail.com>
Tue, 2 Aug 2022 10:08:51 +0000 (12:08 +0200)
commitac051d7ae9512883e11a89ab002ad2d2c3c55c19
treec39e21bcc169d53d7545faf1c710eb7350592b6b
parent00d426b88546a346820c102386cd1bfff82ca8f6
Calculate fee amount after output addition

We would previously calculate the fee amount in two steps:
1. Add the weight of the empty transaction
2. Add the weight of each output

That's unnecessary: you can just use the weight of the transaction
*after* the output addition. This is clearer, but also avoids a
rare bug: if there are many outputs, adding them would cause the
"number of outputs" transaction parameter lenght to increase, and we
wouldn't notice it.
This might still happen when adding the drain output - this
commit also adds a comment as a reminder.
src/wallet/mod.rs