Browse Source

daemon: store revocation hashes in the peer_visible_state structure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
12b9d39b76
  1. 6
      daemon/packets.c
  2. 5
      daemon/peer.h

6
daemon/packets.c

@ -42,12 +42,10 @@ static Pkt *make_pkt(const tal_t *ctx, Pkt__PktCase type, const void *msg)
Pkt *pkt_open(const tal_t *ctx, const struct peer *peer,
OpenChannel__AnchorOffer anchor)
{
struct sha256 revocation_hash;
OpenChannel *o = tal(ctx, OpenChannel);
open_channel__init(o);
peer_get_revocation_hash(peer, 0, &revocation_hash);
o->revocation_hash = sha256_to_proto(ctx, &revocation_hash);
o->revocation_hash = sha256_to_proto(ctx, &peer->us.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);
@ -184,7 +182,7 @@ Pkt *accept_pkt_open(const tal_t *ctx,
if (!proto_to_pubkey(peer->dstate->secpctx,
o->final_key, &peer->them.finalkey))
return pkt_err(ctx, "Bad finalkey");
proto_to_sha256(o->revocation_hash, &peer->their_rhash);
proto_to_sha256(o->revocation_hash, &peer->them.revocation_hash);
return NULL;
}

5
daemon/peer.h

@ -20,6 +20,8 @@ struct peer_visible_state {
unsigned int mindepth;
/* Commitment fee they're offering (satoshi). */
u64 commit_fee;
/* Revocation hash for latest commit tx. */
struct sha256 revocation_hash;
};
struct peer {
@ -58,9 +60,6 @@ struct peer {
/* Stuff we have in common. */
struct peer_visible_state us, them;
/* Their last revocation hash. */
struct sha256 their_rhash;
};
void setup_listeners(struct lightningd_state *dstate, unsigned int portnum);

Loading…
Cancel
Save