mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
state: make tx arguments const.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ebf2bc57d8
commit
144ab3bef4
8
state.c
8
state.c
@ -82,8 +82,8 @@ static void queue_pkt(Pkt **out, Pkt *pkt)
|
||||
*out = pkt;
|
||||
}
|
||||
|
||||
static void queue_tx_broadcast(struct bitcoin_tx **broadcast,
|
||||
struct bitcoin_tx *tx)
|
||||
static void queue_tx_broadcast(const struct bitcoin_tx **broadcast,
|
||||
const struct bitcoin_tx *tx)
|
||||
{
|
||||
assert(!*broadcast);
|
||||
assert(tx);
|
||||
@ -95,10 +95,10 @@ enum command_status state(const tal_t *ctx,
|
||||
const enum state_input input,
|
||||
const union input *idata,
|
||||
Pkt **out,
|
||||
struct bitcoin_tx **broadcast)
|
||||
const struct bitcoin_tx **broadcast)
|
||||
{
|
||||
Pkt *decline;
|
||||
struct bitcoin_tx *tx;
|
||||
const struct bitcoin_tx *tx;
|
||||
Pkt *err;
|
||||
enum command_status cstatus = CMD_NONE;
|
||||
|
||||
|
40
state.h
40
state.h
@ -40,7 +40,7 @@ enum command_status state(const tal_t *ctx,
|
||||
const enum state_input input,
|
||||
const union input *idata,
|
||||
Pkt **out,
|
||||
struct bitcoin_tx **broadcast);
|
||||
const struct bitcoin_tx **broadcast);
|
||||
|
||||
/* Any CMD_SEND_HTLC_* */
|
||||
#define CMD_SEND_UPDATE_ANY INPUT_MAX
|
||||
@ -326,38 +326,38 @@ void bitcoin_create_anchor(struct peer *peer, enum state_input done);
|
||||
void bitcoin_release_anchor(struct peer *peer, enum state_input done);
|
||||
|
||||
/* Get the bitcoin anchor tx. */
|
||||
struct bitcoin_tx *bitcoin_anchor(const tal_t *ctx, struct peer *peer);
|
||||
const struct bitcoin_tx *bitcoin_anchor(const tal_t *ctx, struct peer *peer);
|
||||
|
||||
/* Create a bitcoin close tx. */
|
||||
struct bitcoin_tx *bitcoin_close(const tal_t *ctx,
|
||||
const struct peer *peer);
|
||||
const struct bitcoin_tx *bitcoin_close(const tal_t *ctx,
|
||||
const struct peer *peer);
|
||||
|
||||
/* Create a bitcoin spend tx (to spend our commit's outputs) */
|
||||
struct bitcoin_tx *bitcoin_spend_ours(const tal_t *ctx,
|
||||
const struct peer *peer);
|
||||
const struct bitcoin_tx *bitcoin_spend_ours(const tal_t *ctx,
|
||||
const struct peer *peer);
|
||||
|
||||
/* Create a bitcoin spend tx (to spend their commit's outputs) */
|
||||
struct bitcoin_tx *bitcoin_spend_theirs(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct bitcoin_event *btc);
|
||||
const struct bitcoin_tx *bitcoin_spend_theirs(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct bitcoin_event *btc);
|
||||
|
||||
/* Create a bitcoin steal tx (to steal all their commit's outputs) */
|
||||
struct bitcoin_tx *bitcoin_steal(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
struct bitcoin_event *btc);
|
||||
const struct bitcoin_tx *bitcoin_steal(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
struct bitcoin_event *btc);
|
||||
|
||||
/* Create our commit tx */
|
||||
struct bitcoin_tx *bitcoin_commit(const tal_t *ctx,
|
||||
const struct peer *peer);
|
||||
const struct bitcoin_tx *bitcoin_commit(const tal_t *ctx,
|
||||
const struct peer *peer);
|
||||
|
||||
/* Create a HTLC refund collection */
|
||||
struct bitcoin_tx *bitcoin_htlc_timeout(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc);
|
||||
const struct bitcoin_tx *bitcoin_htlc_timeout(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc);
|
||||
|
||||
/* Create a HTLC collection */
|
||||
struct bitcoin_tx *bitcoin_htlc_spend(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc);
|
||||
const struct bitcoin_tx *bitcoin_htlc_spend(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc);
|
||||
|
||||
#endif /* LIGHTNING_STATE_H */
|
||||
|
@ -858,7 +858,7 @@ static bool bitcoin_tx_is(const struct bitcoin_tx *btx, const char *str)
|
||||
return streq((const char *)btx, str);
|
||||
}
|
||||
|
||||
struct bitcoin_tx *bitcoin_anchor(const tal_t *ctx, struct peer *peer)
|
||||
const struct bitcoin_tx *bitcoin_anchor(const tal_t *ctx, struct peer *peer)
|
||||
{
|
||||
if (!peer->anchor)
|
||||
report_trail(peer->trail, "Can't create anchor tx: no anchor!");
|
||||
@ -866,52 +866,52 @@ struct bitcoin_tx *bitcoin_anchor(const tal_t *ctx, struct peer *peer)
|
||||
return bitcoin_tx("anchor");
|
||||
}
|
||||
|
||||
struct bitcoin_tx *bitcoin_close(const tal_t *ctx,
|
||||
const struct peer *peer)
|
||||
const struct bitcoin_tx *bitcoin_close(const tal_t *ctx,
|
||||
const struct peer *peer)
|
||||
{
|
||||
return bitcoin_tx("close");
|
||||
}
|
||||
|
||||
struct bitcoin_tx *bitcoin_spend_ours(const tal_t *ctx,
|
||||
const struct peer *peer)
|
||||
const struct bitcoin_tx *bitcoin_spend_ours(const tal_t *ctx,
|
||||
const struct peer *peer)
|
||||
{
|
||||
return bitcoin_tx("spend our commit");
|
||||
}
|
||||
|
||||
struct bitcoin_tx *bitcoin_spend_theirs(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct bitcoin_event *btc)
|
||||
const struct bitcoin_tx *bitcoin_spend_theirs(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct bitcoin_event *btc)
|
||||
{
|
||||
return bitcoin_tx("spend their commit");
|
||||
}
|
||||
|
||||
struct bitcoin_tx *bitcoin_steal(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
struct bitcoin_event *btc)
|
||||
const struct bitcoin_tx *bitcoin_steal(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
struct bitcoin_event *btc)
|
||||
{
|
||||
if (fail(peer, FAIL_STEAL))
|
||||
return NULL;
|
||||
return bitcoin_tx("steal");
|
||||
}
|
||||
|
||||
struct bitcoin_tx *bitcoin_commit(const tal_t *ctx,
|
||||
const struct peer *peer)
|
||||
const struct bitcoin_tx *bitcoin_commit(const tal_t *ctx,
|
||||
const struct peer *peer)
|
||||
{
|
||||
return bitcoin_tx("our commit");
|
||||
}
|
||||
|
||||
/* Create a HTLC refund collection */
|
||||
struct bitcoin_tx *bitcoin_htlc_timeout(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc)
|
||||
const struct bitcoin_tx *bitcoin_htlc_timeout(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc)
|
||||
{
|
||||
return htlc_tx(ctx, "htlc timeout", htlc->id);
|
||||
}
|
||||
|
||||
/* Create a HTLC collection */
|
||||
struct bitcoin_tx *bitcoin_htlc_spend(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc)
|
||||
const struct bitcoin_tx *bitcoin_htlc_spend(const tal_t *ctx,
|
||||
const struct peer *peer,
|
||||
const struct htlc *htlc)
|
||||
{
|
||||
return htlc_tx(ctx, "htlc fulfill", htlc->id);
|
||||
}
|
||||
@ -1804,7 +1804,7 @@ static void try_input(const struct peer *peer,
|
||||
struct trail t;
|
||||
const char *problem;
|
||||
Pkt *output;
|
||||
struct bitcoin_tx *broadcast;
|
||||
const struct bitcoin_tx *broadcast;
|
||||
const tal_t *ctx = tal(NULL, char);
|
||||
enum command_status cstatus;
|
||||
|
||||
@ -2229,7 +2229,7 @@ static enum state_input **map_inputs(void)
|
||||
/* This adds to mapping_inputs every input_is() call */
|
||||
if (!state_is_error(i)) {
|
||||
struct peer dummy;
|
||||
struct bitcoin_tx *dummy_tx;
|
||||
const struct bitcoin_tx *dummy_tx;
|
||||
Pkt *dummy_pkt;
|
||||
memset(&dummy, 0, sizeof(dummy));
|
||||
dummy.state = i;
|
||||
|
Loading…
Reference in New Issue
Block a user