mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
channeld: get htlc_maximum_msat from lightningd.
We used to calculate it ourselves. Unfortunately this needs to be done in several places, since new_channel() isn't used to fully create a channel in the case of dual funding :( Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -317,7 +317,7 @@ struct channel *new_unsaved_channel(struct peer *peer,
|
||||
* capacity the reserve we have to keep.
|
||||
* FIXME: does this need fuzz?
|
||||
*/
|
||||
static struct amount_msat htlc_max_possible_send(const struct channel *channel)
|
||||
struct amount_msat htlc_max_possible_send(const struct channel *channel)
|
||||
{
|
||||
struct amount_sat lower_bound;
|
||||
struct amount_msat lower_bound_msat;
|
||||
|
||||
@@ -481,4 +481,5 @@ struct htlc_out *channel_has_htlc_out(struct channel *channel);
|
||||
|
||||
const u8 *get_channel_update(struct channel *channel);
|
||||
|
||||
struct amount_msat htlc_max_possible_send(const struct channel *channel);
|
||||
#endif /* LIGHTNING_LIGHTNINGD_CHANNEL_H */
|
||||
|
||||
@@ -702,6 +702,7 @@ void peer_start_channeld(struct channel *channel,
|
||||
channel->opener,
|
||||
channel->feerate_base,
|
||||
channel->feerate_ppm,
|
||||
channel->htlc_maximum_msat,
|
||||
channel->our_msat,
|
||||
&channel->local_basepoints,
|
||||
&channel->local_funding_pubkey,
|
||||
|
||||
@@ -1110,6 +1110,7 @@ wallet_update_channel(struct lightningd *ld,
|
||||
channel->msat_to_us_min = our_msat;
|
||||
channel->msat_to_us_max = our_msat;
|
||||
channel->lease_expiry = lease_expiry;
|
||||
channel->htlc_maximum_msat = htlc_max_possible_send(channel);
|
||||
|
||||
tal_free(channel->lease_commit_sig);
|
||||
channel->lease_commit_sig = tal_steal(channel, lease_commit_sig);
|
||||
@@ -1252,6 +1253,7 @@ wallet_commit_channel(struct lightningd *ld,
|
||||
|
||||
channel->lease_chan_max_msat = lease_chan_max_msat;
|
||||
channel->lease_chan_max_ppt = lease_chan_max_ppt;
|
||||
channel->htlc_maximum_msat = htlc_max_possible_send(channel);
|
||||
|
||||
/* Now we finally put it in the database. */
|
||||
wallet_channel_insert(ld->wallet, channel);
|
||||
|
||||
Reference in New Issue
Block a user