You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider commitment tx fee while assembling a route
When calculating the amount available to send for the next HTLC, if
we over-count we may create routes which are not actually usable.
Historically this has been an issue, which we resolve over a few
commits.
Here we include the cost of the commitment transaction fee in our
calculation, subtracting the commitment tx fee cost from the
available as we do in `send_payment`.
We also add some testing when sending to ensure that send failures
are accounted for in our balance calculations.
This commit is based on original work by
Gleb Naumenko <[email protected]> and modified by
Matt Corallo <[email protected]>.
returnErr(ChannelError::Ignore(format!("Cannot send value that would overdraw remaining funds. Amount: {}, pending value to self {}", amount_msat, holder_balance_msat)));
returnErr(ChannelError::Ignore(format!("Cannot send value that would not leave enough to pay for fees. Pending value to self: {}. local_commit_tx_fee {}", holder_balance_msat, commit_tx_fee_msat)));
5909
5946
}
5910
5947
5911
5948
// Check self.counterparty_selected_channel_reserve_satoshis (the amount we must keep as
5912
5949
// reserve for the remote to have something to claim if we misbehave)
5913
5950
let chan_reserve_msat = self.counterparty_selected_channel_reserve_satoshis.unwrap()*1000;
5914
5951
if holder_balance_msat - amount_msat - commit_tx_fee_msat < chan_reserve_msat {
returnErr(ChannelError::Ignore(format!("Cannot send value that would put our balance under counterparty-announced channel reserve value ({})", chan_reserve_msat)));
0 commit comments