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

@@ -60,9 +60,6 @@ struct peer {
/* funding_signed packet for fundee, waiting to send. */
const u8 *funding_signed;
/* Channel if locked. */
struct short_channel_id *scid;
/* Minimum funding depth (specified by us if they fund). */
u32 minimum_depth;
@@ -74,6 +71,9 @@ struct peer {
struct sha256_double *funding_txid;
u16 funding_outnum;
u64 funding_satoshi, push_msat;
bool remote_funding_locked;
/* Channel if locked locally. */
struct short_channel_id *scid;
/* Amount going to us, not counting unfinished HTLCs; if we have one. */
u64 *balance;
@@ -81,9 +81,6 @@ struct peer {
/* Keys for channel. */
struct channel_info *channel_info;
/* Their next per-commit point, if known. */
struct pubkey *next_per_commitment_point;
/* Secret seed (FIXME: Move to hsm!) */
struct privkey *seed;