Browse Source

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
paymod-02
niftynei 4 years ago
committed by Christian Decker
parent
commit
ee549a2af9
  1. 4
      bitcoin/tx.c

4
bitcoin/tx.c

@ -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;
}

Loading…
Cancel
Save