diff --git a/lightningd/opening/opening.c b/lightningd/opening/opening.c index 8b221f5a9..500c8d33b 100644 --- a/lightningd/opening/opening.c +++ b/lightningd/opening/opening.c @@ -451,7 +451,8 @@ static u8 *funder_channel(struct state *state, &state->next_per_commit[REMOTE], minimum_depth, &their_funding_pubkey, - &state->funding_txid); + &state->funding_txid, + state->feerate_per_kw); } /* This is handed the message the peer sent which caused gossip to stop: @@ -671,6 +672,7 @@ static u8 *fundee_channel(struct state *state, state->funding_satoshis, state->push_msat, channel_flags, + state->feerate_per_kw, msg); } diff --git a/lightningd/opening/opening_wire.csv b/lightningd/opening/opening_wire.csv index 5801e85f7..bc0944335 100644 --- a/lightningd/opening/opening_wire.csv +++ b/lightningd/opening/opening_wire.csv @@ -50,6 +50,7 @@ opening_funder_reply,,their_per_commit_point,33 opening_funder_reply,,minimum_depth,4 opening_funder_reply,,remote_fundingkey,33 opening_funder_reply,,funding_txid,struct sha256_double +opening_funder_reply,,feerate_per_kw,4 # This means they offer the open (contains their offer packet) opening_fundee,3 @@ -74,6 +75,7 @@ opening_fundee_reply,,funding_txout,u16 opening_fundee_reply,,funding_satoshis,8 opening_fundee_reply,,push_msat,8 opening_fundee_reply,,channel_flags,u8 +opening_fundee_reply,,feerate_per_kw,4 # The (encrypted) funding signed message: send this and we're committed. opening_fundee_reply,,msglen,u16 opening_fundee_reply,,funding_signed_msg,msglen*u8 diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 1d74b8be0..9c7057517 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1273,7 +1273,8 @@ static bool opening_funder_finished(struct subd *opening, const u8 *resp, &channel_info->remote_per_commit, &fc->peer->minimum_depth, &channel_info->remote_fundingkey, - &funding_txid)) { + &funding_txid, + &channel_info->feerate_per_kw)) { log_broken(fc->peer->log, "bad OPENING_FUNDER_REPLY %s", tal_hex(resp, resp)); tal_free(fc->peer); @@ -1372,6 +1373,7 @@ static bool opening_fundee_finished(struct subd *opening, &peer->funding_satoshi, &peer->push_msat, &peer->channel_flags, + &channel_info->feerate_per_kw, &funding_signed)) { log_broken(peer->log, "bad OPENING_FUNDEE_REPLY %s", tal_hex(reply, reply)); @@ -1499,6 +1501,7 @@ void peer_fundee_open(struct peer *peer, const u8 *from_peer, cs, peer->seed); subd_send_msg(peer->owner, take(msg)); + /* FIXME: Expose the min_feerate_per_kw and max_feerate_per_kw in the config */ msg = towire_opening_fundee(peer, peer->minimum_depth, 7500, 150000, from_peer); diff --git a/lightningd/peer_htlcs.h b/lightningd/peer_htlcs.h index 3fbd54ce6..42136f77a 100644 --- a/lightningd/peer_htlcs.h +++ b/lightningd/peer_htlcs.h @@ -12,6 +12,7 @@ struct channel_info { struct pubkey remote_fundingkey; struct basepoints theirbase; struct pubkey remote_per_commit, old_remote_per_commit; + u32 feerate_per_kw; }; /* Get all HTLCs for a peer, to send in init message. */