tx: fix case where input amounts are less than total outputs

when attempting to calculate the fees for a tx where we don't own all of
the outputs, we can overshoot the feerate
This commit is contained in:
niftynei 2020-06-16 17:07:28 -05:00 committed by Christian Decker
parent 9830c94778
commit ee549a2af9

View File

@ -121,7 +121,9 @@ struct amount_sat bitcoin_tx_compute_fee_w_inputs(const struct bitcoin_tx *tx,
ok = amount_sat_sub(&input_val, input_val,
amount_asset_to_sat(&asset));
assert(ok);
if (!ok)
return AMOUNT_SAT(0);
}
return input_val;
}