mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
peer: remove commit_info's prev pointer.
This is the final step before removing old commit_infos entirely. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
19be4dbfe6
commit
e19d5751fe
@ -765,8 +765,7 @@ static Pkt *handle_pkt_commit(struct peer *peer, const Pkt *pkt)
|
||||
return pkt_err(peer, "Empty commit");
|
||||
|
||||
/* Create new commit info for this commit tx. */
|
||||
ci->prev = peer->local.commit;
|
||||
ci->commit_num = ci->prev->commit_num + 1;
|
||||
ci->commit_num = peer->local.commit->commit_num + 1;
|
||||
ci->revocation_hash = peer->local.next_revocation_hash;
|
||||
|
||||
/* BOLT #2:
|
||||
@ -795,6 +794,7 @@ static Pkt *handle_pkt_commit(struct peer *peer, const Pkt *pkt)
|
||||
return pkt_err(peer, "Bad signature");
|
||||
|
||||
/* Switch to the new commitment. */
|
||||
tal_free(peer->local.commit);
|
||||
peer->local.commit = ci;
|
||||
peer_get_revocation_hash(peer, ci->commit_num + 1,
|
||||
&peer->local.next_revocation_hash);
|
||||
@ -1520,8 +1520,7 @@ static void do_commit(struct peer *peer, struct command *jsoncmd)
|
||||
fatal("sent commit with no changes");
|
||||
|
||||
/* Create new commit info for this commit tx. */
|
||||
ci->prev = peer->remote.commit;
|
||||
ci->commit_num = ci->prev->commit_num + 1;
|
||||
ci->commit_num = peer->remote.commit->commit_num + 1;
|
||||
ci->revocation_hash = peer->remote.next_revocation_hash;
|
||||
/* BOLT #2:
|
||||
*
|
||||
@ -1546,6 +1545,7 @@ static void do_commit(struct peer *peer, struct command *jsoncmd)
|
||||
peer_sign_theircommit(peer, ci->tx, &ci->sig->sig);
|
||||
|
||||
/* Switch to the new commitment. */
|
||||
tal_free(peer->remote.commit);
|
||||
peer->remote.commit = ci;
|
||||
|
||||
peer_add_their_commit(peer, &ci->txid, ci->commit_num);
|
||||
|
@ -39,8 +39,6 @@ struct their_commit {
|
||||
};
|
||||
|
||||
struct commit_info {
|
||||
/* Previous one, if any. */
|
||||
struct commit_info *prev;
|
||||
/* Commit number (0 == from open) */
|
||||
u64 commit_num;
|
||||
/* Revocation hash. */
|
||||
|
Loading…
Reference in New Issue
Block a user