move-only: asyncOp_sendmany, target amount calculation moved before find inputs (utxos and notes).
This commit is contained in:
parent
88eef56581
commit
a9f3315872
|
@ -211,6 +211,20 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||
bool isPureTaddrOnlyTx = (isfromtaddr_ && z_outputs_.size() == 0);
|
||||
CAmount minersFee = fee_;
|
||||
|
||||
// First calculate the target
|
||||
CAmount t_outputs_total = 0;
|
||||
for (SendManyRecipient & t : t_outputs_) {
|
||||
t_outputs_total += t.amount;
|
||||
}
|
||||
|
||||
CAmount z_outputs_total = 0;
|
||||
for (SendManyRecipient & t : z_outputs_) {
|
||||
z_outputs_total += t.amount;
|
||||
}
|
||||
|
||||
CAmount sendAmount = z_outputs_total + t_outputs_total;
|
||||
CAmount targetAmount = sendAmount + minersFee;
|
||||
|
||||
// When spending coinbase utxos, you can only specify a single zaddr as the change must go somewhere
|
||||
// and if there are multiple zaddrs, we don't know where to send it.
|
||||
if (isfromtaddr_) {
|
||||
|
@ -252,19 +266,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||
z_inputs_total += t.note.value();
|
||||
}
|
||||
|
||||
CAmount t_outputs_total = 0;
|
||||
for (SendManyRecipient & t : t_outputs_) {
|
||||
t_outputs_total += t.amount;
|
||||
}
|
||||
|
||||
CAmount z_outputs_total = 0;
|
||||
for (SendManyRecipient & t : z_outputs_) {
|
||||
z_outputs_total += t.amount;
|
||||
}
|
||||
|
||||
CAmount sendAmount = z_outputs_total + t_outputs_total;
|
||||
CAmount targetAmount = sendAmount + minersFee;
|
||||
|
||||
assert(!isfromtaddr_ || z_inputs_total == 0);
|
||||
assert(!isfromzaddr_ || t_inputs_total == 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue