Skip to content

Commit

Permalink
onchaind: two minor tidyups.
Browse files Browse the repository at this point in the history
Firstly, amount should not be `static`, so use a separate line to
declare those (fee is static, as it's cached across calls).

Secondly, new_tracked_output doesn't take(), it copies.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Apr 5, 2023
1 parent 3a61f3a commit 38bc049
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions onchaind/onchaind.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ static bool set_htlc_timeout_fee(struct bitcoin_tx *tx,
const struct bitcoin_signature *remotesig,
const u8 *wscript)
{
static struct amount_sat amount, fee = AMOUNT_SAT_INIT(UINT64_MAX);
static struct amount_sat fee = AMOUNT_SAT_INIT(UINT64_MAX);
struct amount_sat amount;
struct amount_asset asset = bitcoin_tx_output_get_amount(tx, 0);
size_t weight;

Expand Down Expand Up @@ -541,7 +542,8 @@ static void set_htlc_success_fee(struct bitcoin_tx *tx,
const struct bitcoin_signature *remotesig,
const u8 *wscript)
{
static struct amount_sat amt, fee = AMOUNT_SAT_INIT(UINT64_MAX);
static struct amount_sat fee = AMOUNT_SAT_INIT(UINT64_MAX);
struct amount_sat amt;
struct amount_asset asset;
size_t weight;

Expand Down Expand Up @@ -990,7 +992,7 @@ new_tracked_output(struct tracked_output ***outs,
enum output_type output_type,
const struct htlc_stub *htlc,
const u8 *wscript,
const struct bitcoin_signature *remote_htlc_sig TAKES)
const struct bitcoin_signature *remote_htlc_sig)
{
struct tracked_output *out = tal(*outs, struct tracked_output);

Expand Down

0 comments on commit 38bc049

Please sign in to comment.