channeld: Pass through the agreed feerate_per_kw to channeld

We were erroneously using the fee_base which refers to the fees we
require for forwarding transactions instead of the on-chain fees.
This commit is contained in:
Christian Decker 2017-06-29 18:55:52 +02:00 committed by Rusty Russell
parent 5c80963577
commit 70f4484ba8
4 changed files with 6 additions and 2 deletions

View file

@ -125,7 +125,7 @@ static inline u16 to_self_delay(const struct channel *channel, enum side side)
* @funding_txout: The commitment transaction output number. * @funding_txout: The commitment transaction output number.
* @funding_satoshis: The commitment transaction amount. * @funding_satoshis: The commitment transaction amount.
* @local_msatoshi: The amount for the local side (remainder goes to remote) * @local_msatoshi: The amount for the local side (remainder goes to remote)
* @feerate_per_kw: feerate per kiloweight (satoshis) * @feerate_per_kw: feerate per kiloweight (satoshis) for the settlement transaction
* @local: local channel configuration * @local: local channel configuration
* @remote: remote channel configuration * @remote: remote channel configuration
* @local_basepoints: local basepoints. * @local_basepoints: local basepoints.

View file

@ -1617,12 +1617,14 @@ static void init_channel(struct peer *peer)
bool reconnected; bool reconnected;
u8 *funding_signed; u8 *funding_signed;
u8 *msg; u8 *msg;
u32 feerate_per_kw;
msg = wire_sync_read(peer, REQ_FD); msg = wire_sync_read(peer, REQ_FD);
if (!fromwire_channel_init(peer, msg, NULL, if (!fromwire_channel_init(peer, msg, NULL,
&funding_txid, &funding_txout, &funding_txid, &funding_txout,
&funding_satoshi, &funding_satoshi,
&peer->conf[LOCAL], &peer->conf[REMOTE], &peer->conf[LOCAL], &peer->conf[REMOTE],
&feerate_per_kw,
&peer->their_commit_sig, &peer->their_commit_sig,
&peer->pcs.cs, &peer->pcs.cs,
&funding_pubkey[REMOTE], &funding_pubkey[REMOTE],
@ -1689,7 +1691,7 @@ static void init_channel(struct peer *peer)
peer->channel = new_channel(peer, &funding_txid, funding_txout, peer->channel = new_channel(peer, &funding_txid, funding_txout,
funding_satoshi, funding_satoshi,
local_msatoshi, local_msatoshi,
peer->fee_base, feerate_per_kw,
&peer->conf[LOCAL], &peer->conf[REMOTE], &peer->conf[LOCAL], &peer->conf[REMOTE],
&points[LOCAL], &points[REMOTE], &points[LOCAL], &points[REMOTE],
&funding_pubkey[LOCAL], &funding_pubkey[LOCAL],

View file

@ -27,6 +27,7 @@ channel_init,,funding_txout,2
channel_init,,funding_satoshi,8 channel_init,,funding_satoshi,8
channel_init,,our_config,struct channel_config channel_init,,our_config,struct channel_config
channel_init,,their_config,struct channel_config channel_init,,their_config,struct channel_config
channel_init,,feerate_per_kw,4
channel_init,,first_commit_sig,secp256k1_ecdsa_signature channel_init,,first_commit_sig,secp256k1_ecdsa_signature
channel_init,,crypto_state,struct crypto_state channel_init,,crypto_state,struct crypto_state
channel_init,,remote_fundingkey,33 channel_init,,remote_fundingkey,33

1 # Shouldn't happen
27 channel_init,,remote_fundingkey,33 channel_init,,crypto_state,struct crypto_state
28 channel_init,,revocation_basepoint,33 channel_init,,remote_fundingkey,33
29 channel_init,,payment_basepoint,33 channel_init,,revocation_basepoint,33
30 channel_init,,payment_basepoint,33
31 channel_init,,delayed_payment_basepoint,33
32 channel_init,,remote_per_commit,33
33 channel_init,,old_remote_per_commit,33

View file

@ -1196,6 +1196,7 @@ static bool peer_start_channeld(struct peer *peer,
peer->funding_satoshi, peer->funding_satoshi,
&peer->our_config, &peer->our_config,
&peer->channel_info->their_config, &peer->channel_info->their_config,
peer->channel_info->feerate_per_kw,
&peer->channel_info->commit_sig, &peer->channel_info->commit_sig,
cs, cs,
&peer->channel_info->remote_fundingkey, &peer->channel_info->remote_fundingkey,