Skip to content

Commit a8a7103

Browse files
authored
Use rpc.get_fee_rate for operator withdrawals (#1212)
1 parent 5ae25cf commit a8a7103

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

core/src/operator.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,26 @@ where
694694
)
695695
.wrap_err("Failed to verify signature received from user for payout txin. Ensure the signature uses SinglePlusAnyoneCanPay sighash type.")?;
696696

697+
let fee_rate_result = self
698+
.rpc
699+
.get_fee_rate(
700+
self.config.protocol_paramset.network,
701+
&self.config.mempool_api_host,
702+
&self.config.mempool_api_endpoint,
703+
self.config.tx_sender_limits.mempool_fee_rate_multiplier,
704+
self.config.tx_sender_limits.mempool_fee_rate_offset_sat_kvb,
705+
self.config.tx_sender_limits.fee_rate_hard_cap,
706+
)
707+
.await;
708+
709+
let fee_rate_option = match fee_rate_result {
710+
Ok(fee_rate) => Some(Amount::from_sat(fee_rate.to_sat_per_vb_ceil() * 1000)),
711+
Err(e) => {
712+
tracing::warn!("Failed to get fee rate from mempool API; funding tx with automatic fee rate. Error: {e:?}");
713+
None
714+
}
715+
};
716+
697717
// send payout tx using RBF
698718
let funded_tx = self
699719
.rpc
@@ -706,7 +726,7 @@ where
706726
change_type: None,
707727
include_watching: None,
708728
lock_unspents: Some(false),
709-
fee_rate: None,
729+
fee_rate: fee_rate_option,
710730
subtract_fee_from_outputs: None,
711731
replaceable: None,
712732
conf_target: None,

0 commit comments

Comments
 (0)