mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
daemon: rename num_htlcs to commit_tx_counter.
Much clearer name. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
983000428f
commit
1f9103c9d3
@ -216,8 +216,8 @@ Pkt *pkt_update_signature(const tal_t *ctx, const struct peer *peer)
|
||||
|
||||
peer_sign_theircommit(peer, cur->their_commit, &sig);
|
||||
u->sig = signature_to_proto(u, &sig);
|
||||
assert(peer->num_htlcs > 0);
|
||||
peer_get_revocation_preimage(peer, peer->num_htlcs-1, &preimage);
|
||||
assert(peer->commit_tx_counter > 0);
|
||||
peer_get_revocation_preimage(peer, peer->commit_tx_counter-1, &preimage);
|
||||
u->revocation_preimage = sha256_to_proto(u, &preimage);
|
||||
|
||||
return make_pkt(ctx, PKT__PKT_UPDATE_SIGNATURE, u);
|
||||
@ -230,7 +230,8 @@ Pkt *pkt_update_complete(const tal_t *ctx, const struct peer *peer)
|
||||
|
||||
update_complete__init(u);
|
||||
|
||||
peer_get_revocation_preimage(peer, peer->num_htlcs-1, &preimage);
|
||||
assert(peer->commit_tx_counter > 0);
|
||||
peer_get_revocation_preimage(peer, peer->commit_tx_counter-1, &preimage);
|
||||
u->revocation_preimage = sha256_to_proto(u, &preimage);
|
||||
|
||||
return make_pkt(ctx, PKT__PKT_UPDATE_COMPLETE, u);
|
||||
@ -473,7 +474,7 @@ Pkt *accept_pkt_htlc_add(const tal_t *ctx,
|
||||
&cur->htlc->expiry, &cur->htlc->rhash);
|
||||
peer_add_htlc_expiry(peer, &cur->htlc->expiry);
|
||||
|
||||
peer_get_revocation_hash(peer, peer->num_htlcs+1,
|
||||
peer_get_revocation_hash(peer, peer->commit_tx_counter+1,
|
||||
&cur->our_revocation_hash);
|
||||
memcheck(&cur->their_revocation_hash, sizeof(cur->their_revocation_hash));
|
||||
|
||||
@ -532,7 +533,7 @@ Pkt *accept_pkt_htlc_fail(const tal_t *ctx, struct peer *peer, const Pkt *pkt)
|
||||
funding_remove_htlc(&cur->cstate->a, i);
|
||||
/* FIXME: Remove timer. */
|
||||
|
||||
peer_get_revocation_hash(peer, peer->num_htlcs+1,
|
||||
peer_get_revocation_hash(peer, peer->commit_tx_counter+1,
|
||||
&cur->our_revocation_hash);
|
||||
|
||||
/* Now we create the commit tx pair. */
|
||||
@ -588,7 +589,7 @@ Pkt *accept_pkt_htlc_timedout(const tal_t *ctx,
|
||||
funding_remove_htlc(&cur->cstate->a, i);
|
||||
/* FIXME: Remove timer. */
|
||||
|
||||
peer_get_revocation_hash(peer, peer->num_htlcs+1,
|
||||
peer_get_revocation_hash(peer, peer->commit_tx_counter+1,
|
||||
&cur->our_revocation_hash);
|
||||
|
||||
/* Now we create the commit tx pair. */
|
||||
@ -638,7 +639,7 @@ Pkt *accept_pkt_htlc_fulfill(const tal_t *ctx,
|
||||
}
|
||||
funding_remove_htlc(&cur->cstate->a, i);
|
||||
|
||||
peer_get_revocation_hash(peer, peer->num_htlcs+1,
|
||||
peer_get_revocation_hash(peer, peer->commit_tx_counter+1,
|
||||
&cur->our_revocation_hash);
|
||||
|
||||
/* Now we create the commit tx pair. */
|
||||
@ -694,7 +695,7 @@ static void update_to_new_htlcs(struct peer *peer)
|
||||
peer->us.revocation_hash = cur->our_revocation_hash;
|
||||
peer->them.revocation_hash = cur->their_revocation_hash;
|
||||
|
||||
peer->num_htlcs++;
|
||||
peer->commit_tx_counter++;
|
||||
}
|
||||
|
||||
Pkt *accept_pkt_update_accept(const tal_t *ctx,
|
||||
|
@ -340,7 +340,7 @@ static struct peer *new_peer(struct lightningd_state *dstate,
|
||||
peer->curr_cmd.cmd = INPUT_NONE;
|
||||
list_head_init(&peer->pending_cmd);
|
||||
peer->current_htlc = NULL;
|
||||
peer->num_htlcs = 0;
|
||||
peer->commit_tx_counter = 0;
|
||||
peer->close_tx = NULL;
|
||||
peer->cstate = NULL;
|
||||
peer->close_watch_timeout = NULL;
|
||||
@ -1292,7 +1292,7 @@ static void set_htlc_command(struct peer *peer,
|
||||
if (r_fulfill)
|
||||
peer->current_htlc->r = *r_fulfill;
|
||||
|
||||
peer_get_revocation_hash(peer, peer->num_htlcs+1,
|
||||
peer_get_revocation_hash(peer, peer->commit_tx_counter+1,
|
||||
&peer->current_htlc->our_revocation_hash);
|
||||
|
||||
/* FIXME: Do we need current_htlc as idata arg? */
|
||||
|
@ -112,7 +112,7 @@ struct peer {
|
||||
/* Current HTLC, if any. */
|
||||
struct htlc_progress *current_htlc;
|
||||
/* Number of HTLC updates (== number of previous commit txs) */
|
||||
u64 num_htlcs;
|
||||
u64 commit_tx_counter;
|
||||
|
||||
/* FIXME: Group closing fields together in anon struct. */
|
||||
/* Closing tx and signature once we've generated it */
|
||||
|
Loading…
Reference in New Issue
Block a user