Browse Source

elements: Change function prefix to elements_ for some functions

Suggested-by: Rusty Russell <@rustyrussell>
travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
378745391d
  1. 8
      bitcoin/tx.c
  2. 2
      bitcoin/tx.h
  3. 2
      channeld/commit_tx.c
  4. 2
      common/close_tx.c
  5. 2
      common/funding_tx.c
  6. 2
      common/htlc_tx.c
  7. 2
      common/initial_commit_tx.c
  8. 2
      common/withdraw_tx.c
  9. 8
      onchaind/onchaind.c

8
bitcoin/tx.c

@ -62,7 +62,7 @@ int bitcoin_tx_add_multi_outputs(struct bitcoin_tx *tx,
return tx->wtx->num_outputs;
}
static bool bitcoin_tx_output_is_fee(const struct bitcoin_tx *tx, int outnum)
static bool elements_tx_output_is_fee(const struct bitcoin_tx *tx, int outnum)
{
assert(outnum < tx->wtx->num_outputs);
return is_elements && tx->wtx->outputs[outnum].script_len == 0;
@ -79,7 +79,7 @@ static u64 bitcoin_tx_compute_fee(const struct bitcoin_tx *tx)
fee += tx->input_amounts[i]->satoshis; /* Raw: fee computation */
for (size_t i=0; i<tx->wtx->num_outputs; i++) {
if (bitcoin_tx_output_is_fee(tx, i))
if (elements_tx_output_is_fee(tx, i))
continue;
if (!is_elements) {
@ -95,7 +95,7 @@ static u64 bitcoin_tx_compute_fee(const struct bitcoin_tx *tx)
return fee;
}
int bitcoin_tx_add_fee_output(struct bitcoin_tx *tx)
int elements_tx_add_fee_output(struct bitcoin_tx *tx)
{
struct amount_sat fee;
int pos = -1;
@ -108,7 +108,7 @@ int bitcoin_tx_add_fee_output(struct bitcoin_tx *tx)
/* Try to find any existing fee output */
for (int i=0; i<tx->wtx->num_outputs; i++) {
if (bitcoin_tx_output_is_fee(tx, i)) {
if (elements_tx_output_is_fee(tx, i)) {
assert(pos == -1);
pos = i;
}

2
bitcoin/tx.h

@ -158,6 +158,6 @@ bool bitcoin_tx_check(const struct bitcoin_tx *tx);
* Returns the position of the fee output, or -1 in the case of non-elements
* transactions.
*/
int bitcoin_tx_add_fee_output(struct bitcoin_tx *tx);
int elements_tx_add_fee_output(struct bitcoin_tx *tx);
#endif /* LIGHTNING_BITCOIN_TX_H */

2
channeld/commit_tx.c

@ -289,7 +289,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
u32 sequence = (0x80000000 | ((obscured_commitment_number>>24) & 0xFFFFFF));
bitcoin_tx_add_input(tx, funding_txid, funding_txout, sequence, funding, NULL);
bitcoin_tx_add_fee_output(tx);
elements_tx_add_fee_output(tx);
return tx;
}

2
common/close_tx.c

@ -61,7 +61,7 @@ struct bitcoin_tx *create_close_tx(const tal_t *ctx,
return tal_free(tx);
permute_outputs(tx, NULL, NULL);
bitcoin_tx_add_fee_output(tx);
elements_tx_add_fee_output(tx);
assert(bitcoin_tx_check(tx));
return tx;

2
common/funding_tx.c

@ -49,7 +49,7 @@ struct bitcoin_tx *funding_tx(const tal_t *ctx,
permute_inputs(tx, (const void **)utxomap);
bitcoin_tx_add_fee_output(tx);
elements_tx_add_fee_output(tx);
assert(bitcoin_tx_check(tx));
return tx;
}

2
common/htlc_tx.c

@ -63,7 +63,7 @@ static struct bitcoin_tx *htlc_tx(const tal_t *ctx,
wscript = bitcoin_wscript_htlc_tx(tx, to_self_delay, revocation_pubkey,
local_delayedkey);
bitcoin_tx_add_output(tx, scriptpubkey_p2wsh(tx, wscript), amount);
bitcoin_tx_add_fee_output(tx);
elements_tx_add_fee_output(tx);
tal_free(wscript);

2
common/initial_commit_tx.c

@ -237,7 +237,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
sequence = (0x80000000 | ((obscured_commitment_number>>24) & 0xFFFFFF));
bitcoin_tx_add_input(tx, funding_txid, funding_txout, sequence, funding, NULL);
bitcoin_tx_add_fee_output(tx);
elements_tx_add_fee_output(tx);
assert(bitcoin_tx_check(tx));
return tx;

2
common/withdraw_tx.c

@ -38,7 +38,7 @@ struct bitcoin_tx *withdraw_tx(const tal_t *ctx,
} else if (change_outnum)
*change_outnum = -1;
permute_inputs(tx, (const void **)utxos);
bitcoin_tx_add_fee_output(tx);
elements_tx_add_fee_output(tx);
assert(bitcoin_tx_check(tx));
return tx;
}

8
onchaind/onchaind.c

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

Loading…
Cancel
Save