@@ -78,41 +78,6 @@ enum OnchainEvent {
78
78
}
79
79
}
80
80
81
- macro_rules! subtract_high_prio_fee {
82
- ( $logger: ident, $fee_estimator: expr, $value: expr, $predicted_weight: expr, $used_feerate: expr) => {
83
- {
84
- $used_feerate = $fee_estimator. get_est_sat_per_1000_weight( ConfirmationTarget :: HighPriority ) . into( ) ;
85
- let mut fee = $used_feerate as u64 * $predicted_weight / 1000 ;
86
- if $value <= fee {
87
- $used_feerate = $fee_estimator. get_est_sat_per_1000_weight( ConfirmationTarget :: Normal ) . into( ) ;
88
- fee = $used_feerate as u64 * $predicted_weight / 1000 ;
89
- if $value <= fee. into( ) {
90
- $used_feerate = $fee_estimator. get_est_sat_per_1000_weight( ConfirmationTarget :: Background ) . into( ) ;
91
- fee = $used_feerate as u64 * $predicted_weight / 1000 ;
92
- if $value <= fee {
93
- log_error!( $logger, "Failed to generate an on-chain punishment tx as even low priority fee ({} sat) was more than the entire claim balance ({} sat)" ,
94
- fee, $value) ;
95
- false
96
- } else {
97
- log_warn!( $logger, "Used low priority fee for on-chain punishment tx as high priority fee was more than the entire claim balance ({} sat)" ,
98
- $value) ;
99
- $value -= fee;
100
- true
101
- }
102
- } else {
103
- log_warn!( $logger, "Used medium priority fee for on-chain punishment tx as high priority fee was more than the entire claim balance ({} sat)" ,
104
- $value) ;
105
- $value -= fee;
106
- true
107
- }
108
- } else {
109
- $value -= fee;
110
- true
111
- }
112
- }
113
- }
114
- }
115
-
116
81
impl Readable for Option < Vec < Option < ( usize , Signature ) > > > {
117
82
fn read < R : :: std:: io:: Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
118
83
match Readable :: read ( reader) ? {
@@ -380,45 +345,6 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
380
345
{
381
346
if cached_request. outpoints ( ) . len ( ) == 0 { return None } // But don't prune pending claiming request yet, we may have to resurrect HTLCs
382
347
383
- macro_rules! RBF_bump {
384
- ( $amount: expr, $old_feerate: expr, $fee_estimator: expr, $predicted_weight: expr) => {
385
- {
386
- let mut used_feerate: u32 ;
387
- // If old feerate inferior to actual one given back by Fee Estimator, use it to compute new fee...
388
- let new_fee = if $old_feerate < $fee_estimator. get_est_sat_per_1000_weight( ConfirmationTarget :: HighPriority ) as u64 {
389
- let mut value = $amount;
390
- if subtract_high_prio_fee!( logger, $fee_estimator, value, $predicted_weight, used_feerate) {
391
- // Overflow check is done in subtract_high_prio_fee
392
- ( $amount - value)
393
- } else {
394
- log_trace!( logger, "Can't new-estimation bump new claiming tx, amount {} is too small" , $amount) ;
395
- return None ;
396
- }
397
- // ...else just increase the previous feerate by 25% (because that's a nice number)
398
- } else {
399
- let fee = $old_feerate as u64 * ( $predicted_weight as u64 ) / 750 ;
400
- if $amount <= fee {
401
- log_trace!( logger, "Can't 25% bump new claiming tx, amount {} is too small" , $amount) ;
402
- return None ;
403
- }
404
- fee
405
- } ;
406
-
407
- let previous_fee = $old_feerate as u64 * ( $predicted_weight as u64 ) / 1000 ;
408
- let min_relay_fee = MIN_RELAY_FEE_SAT_PER_1000_WEIGHT * ( $predicted_weight as u64 ) / 1000 ;
409
- // BIP 125 Opt-in Full Replace-by-Fee Signaling
410
- // * 3. The replacement transaction pays an absolute fee of at least the sum paid by the original transactions.
411
- // * 4. The replacement transaction must also pay for its own bandwidth at or above the rate set by the node's minimum relay fee setting.
412
- let new_fee = if new_fee < previous_fee + min_relay_fee {
413
- new_fee + previous_fee + min_relay_fee - new_fee
414
- } else {
415
- new_fee
416
- } ;
417
- Some ( ( new_fee, new_fee * 1000 / ( $predicted_weight as u64 ) ) )
418
- }
419
- }
420
- }
421
-
422
348
// Compute new height timer to decide when we need to regenerate a new bumped version of the claim tx (if we
423
349
// didn't receive confirmation of it before, or not enough reorg-safe depth on top of it).
424
350
let new_timer = Some ( Self :: get_height_timer ( height, cached_request. timelock ( ) ) ) ;
0 commit comments