wally: Migrate main daemon to use wally transactions

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-03-25 11:35:56 +01:00
committed by Rusty Russell
parent c39963b8b7
commit d651ce6f3b
13 changed files with 73 additions and 69 deletions

View File

@@ -20,9 +20,10 @@
static struct amount_sat calc_tx_fee(struct amount_sat sat_in,
const struct bitcoin_tx *tx)
{
struct amount_sat fee = sat_in;
for (size_t i = 0; i < tal_count(tx->output); i++) {
if (!amount_sat_sub(&fee, fee, tx->output[i].amount))
struct amount_sat amt, fee = sat_in;
for (size_t i = 0; i < tx->wtx->num_outputs; i++) {
amt = bitcoin_tx_output_get_amount(tx, i);
if (!amount_sat_sub(&fee, fee, amt))
fatal("Tx spends more than input %s? %s",
type_to_string(tmpctx, struct amount_sat, &sat_in),
type_to_string(tmpctx, struct bitcoin_tx, tx));