mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-22 23:34:21 +01:00
protocol: include next revocation hash in open packet.
This means we send the first two revocation hashes; this is important once we move to a commit model as we need to send (unsolicited) the signature for the *next* commit tx so we need its commit hash. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -74,6 +74,7 @@ Pkt *pkt_open(const tal_t *ctx, const struct peer *peer,
|
||||
|
||||
open_channel__init(o);
|
||||
o->revocation_hash = sha256_to_proto(ctx, &peer->us.revocation_hash);
|
||||
o->next_revocation_hash = sha256_to_proto(ctx, &peer->us.next_revocation_hash);
|
||||
o->commit_key = pubkey_to_proto(o, &peer->us.commitkey);
|
||||
o->final_key = pubkey_to_proto(o, &peer->us.finalkey);
|
||||
o->delay = tal(o, Locktime);
|
||||
@@ -317,6 +318,7 @@ Pkt *accept_pkt_open(const tal_t *ctx,
|
||||
o->final_key, &peer->them.finalkey))
|
||||
return pkt_err(ctx, "Bad finalkey");
|
||||
proto_to_sha256(o->revocation_hash, &peer->them.revocation_hash);
|
||||
proto_to_sha256(o->next_revocation_hash, &peer->them.next_revocation_hash);
|
||||
|
||||
/* Redeemscript for anchor. */
|
||||
peer->anchor.redeemscript
|
||||
|
||||
@@ -270,6 +270,7 @@ static struct io_plan *peer_crypto_on(struct io_conn *conn, struct peer *peer)
|
||||
{
|
||||
peer_secrets_init(peer);
|
||||
peer_get_revocation_hash(peer, 0, &peer->us.revocation_hash);
|
||||
peer_get_revocation_hash(peer, 1, &peer->us.next_revocation_hash);
|
||||
|
||||
assert(peer->state == STATE_INIT);
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ struct peer_visible_state {
|
||||
u64 commit_fee;
|
||||
/* Revocation hash for latest commit tx. */
|
||||
struct sha256 revocation_hash;
|
||||
/* Revocation hash for next commit tx. */
|
||||
struct sha256 next_revocation_hash;
|
||||
/* Current commit tx. */
|
||||
struct bitcoin_tx *commit;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user