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
This resolves a number of bugs around how we calculate feerates on
closing transactions:
* We previously calculated the weight wrong both by always
counting two outputs instead of counting the number of outputs
that actually exist in the closing transaction and by not
counting the witness redeemscript.
* We use assertions to check the calculated weight matches what we
actually build (with debug_assertions for variable-length sigs).
* As an additional sanity check, we really should check that the
transaction had at least min-relay-fee when we were the channel
initator.
let tx_weight = Self::get_closing_transaction_weight(&self.get_closing_scriptpubkey(),self.counterparty_shutdown_scriptpubkey.as_ref().unwrap());
2905
+
let tx_weight = self.get_closing_transaction_weight(Some(&self.get_closing_scriptpubkey()),Some(self.counterparty_shutdown_scriptpubkey.as_ref().unwrap()));
2884
2906
let proposed_total_fee_satoshis = proposed_feerate asu64* tx_weight / 1000;
letmut min_feerate_per_kw = 253;// Min relay fee of at least 1 sat/vbyte (rounding up to ensure its never below 1 when divided by 4 to convert weight->vbyte).
3060
3089
ifself.channel_outbound{
3061
3090
let max_feerate = fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::Normal);
returnErr(ChannelError::Close(format!("Unable to come to consensus about closing feerate, remote wanted something higher ({}) than our Normal feerate ({})", last_feerate, max_feerate)));
returnErr(ChannelError::Close(format!("Unable to come to consensus about closing feerate, remote wanted something lower ({}) than our Background feerate ({}).",last_feerate, min_feerate)));
returnErr(ChannelError::Close(format!("Unable to come to consensus about closing feerate, remote wanted something lower ({}) than our Background feerate ({}).", last_feerate, min_feerate_per_kw)));
0 commit comments