channeld: save old remote_per_commit and return it in init.

We need the old remote per_commitment_point so we can validate the
per_commitment_secret when we get it.

We unify this housekeeping in the master daemon using
update_per_commit_point().

This patch also saves whether remote funding is locked, and disallows
doing that twice (channeld should ignore it).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-06-20 15:45:03 +09:30
parent e3debe5adb
commit d236e724a9
6 changed files with 35 additions and 28 deletions

View File

@@ -11,7 +11,7 @@ struct channel_info {
struct channel_config their_config;
struct pubkey remote_fundingkey;
struct basepoints theirbase;
struct pubkey their_per_commit_point;
struct pubkey remote_per_commit, old_remote_per_commit;
};
/* Get all HTLCs for a peer, to send in init message. */
@@ -31,6 +31,9 @@ int peer_sending_commitsig(struct peer *peer, const u8 *msg);
int peer_got_commitsig(struct peer *peer, const u8 *msg);
int peer_got_revoke(struct peer *peer, const u8 *msg);
void update_per_commit_point(struct peer *peer,
const struct pubkey *per_commitment_point);
enum onion_type send_htlc_out(struct peer *out, u64 amount, u32 cltv,
const struct sha256 *payment_hash,
const u8 *onion_routing_packet,