Browse Source

elements: onchaind must add fees to its transactions

Signed-off-by: Christian Decker <decker.christian@gmail.com>
travis-debug
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
bb76d6daa6
  1. 5
      onchaind/onchaind.c

5
onchaind/onchaind.c

@ -147,6 +147,7 @@ static bool grind_htlc_tx_fee(struct amount_sat *fee,
break; break;
bitcoin_tx_output_set_amount(tx, 0, out); bitcoin_tx_output_set_amount(tx, 0, out);
bitcoin_tx_add_fee_output(tx);
if (!check_tx_sig(tx, 0, NULL, wscript, if (!check_tx_sig(tx, 0, NULL, wscript,
&keyset->other_htlc_key, remotesig)) &keyset->other_htlc_key, remotesig))
continue; continue;
@ -189,6 +190,7 @@ static bool set_htlc_timeout_fee(struct bitcoin_tx *tx,
type_to_string(tmpctx, struct bitcoin_tx, tx)); type_to_string(tmpctx, struct bitcoin_tx, tx));
bitcoin_tx_output_set_amount(tx, 0, amount); bitcoin_tx_output_set_amount(tx, 0, amount);
bitcoin_tx_add_fee_output(tx);
return check_tx_sig(tx, 0, NULL, wscript, return check_tx_sig(tx, 0, NULL, wscript,
&keyset->other_htlc_key, remotesig); &keyset->other_htlc_key, remotesig);
} }
@ -227,7 +229,7 @@ static void set_htlc_success_fee(struct bitcoin_tx *tx,
type_to_string(tmpctx, struct amount_sat, &fee), type_to_string(tmpctx, struct amount_sat, &fee),
type_to_string(tmpctx, struct bitcoin_tx, tx)); type_to_string(tmpctx, struct bitcoin_tx, tx));
bitcoin_tx_output_set_amount(tx, 0, amt); bitcoin_tx_output_set_amount(tx, 0, amt);
bitcoin_tx_add_fee_output(tx);
if (check_tx_sig(tx, 0, NULL, wscript, if (check_tx_sig(tx, 0, NULL, wscript,
&keyset->other_htlc_key, remotesig)) &keyset->other_htlc_key, remotesig))
@ -359,6 +361,7 @@ static struct bitcoin_tx *tx_to_us(const tal_t *ctx,
&amt)); &amt));
} }
bitcoin_tx_output_set_amount(tx, 0, amt); bitcoin_tx_output_set_amount(tx, 0, amt);
bitcoin_tx_add_fee_output(tx);
if (!wire_sync_write(HSM_FD, take(hsm_sign_msg(NULL, tx, wscript)))) if (!wire_sync_write(HSM_FD, take(hsm_sign_msg(NULL, tx, wscript))))
status_failed(STATUS_FAIL_HSM_IO, "Writing sign request to hsm"); status_failed(STATUS_FAIL_HSM_IO, "Writing sign request to hsm");

Loading…
Cancel
Save