mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
channel: fix max feelevel calculation.
We were out by 1000, and also derived it from the previous, not current state. Reported-by: Christian Decker Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ab569c069f
commit
25b3dc0038
@ -172,7 +172,7 @@ uint64_t approx_max_feerate(const struct channel_state *cstate,
|
||||
|
||||
max_funds = cstate->side[side].pay_msat + cstate->side[side].fee_msat;
|
||||
|
||||
return max_funds * 1000 / tx_bytes(cstate->num_nondust);
|
||||
return max_funds / tx_bytes(cstate->num_nondust);
|
||||
}
|
||||
|
||||
bool can_afford_feerate(const struct channel_state *cstate, uint64_t fee_rate,
|
||||
|
@ -2119,7 +2119,8 @@ static void maybe_propose_new_feerate(struct peer *peer)
|
||||
u64 rate, max_rate;
|
||||
|
||||
rate = desired_commit_feerate(peer->dstate);
|
||||
max_rate = approx_max_feerate(peer->remote.commit->cstate, LOCAL);
|
||||
max_rate = approx_max_feerate(peer->remote.staging_cstate, LOCAL);
|
||||
assert(can_afford_feerate(peer->remote.staging_cstate, max_rate, LOCAL));
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user