File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -87,8 +87,10 @@ impl Miner {
87
87
. unwrap ( ) ,
88
88
FeeStrategy :: Triton => {
89
89
serde_json:: from_value :: < Vec < RpcPrioritizationFee > > ( response[ "result" ] . clone ( ) )
90
- . map ( |arr| estimate_prioritization_fee_micro_lamports ( & arr) )
91
- . or_else ( |error| {
90
+ . map ( |prioritization_fees| {
91
+ estimate_prioritization_fee_micro_lamports ( prioritization_fees)
92
+ } )
93
+ . or_else ( |error : serde_json:: Error | {
92
94
Err ( format ! (
93
95
"Failed to parse priority fee. Response: {response:?}, error: {error}"
94
96
) )
@@ -107,18 +109,17 @@ impl Miner {
107
109
}
108
110
109
111
/// Our estimate is the average over the last 20 slots
110
- /// Take last 20 slots and average
111
112
pub fn estimate_prioritization_fee_micro_lamports (
112
- prioritization_fees : & [ RpcPrioritizationFee ] ,
113
+ prioritization_fees : Vec < RpcPrioritizationFee > ,
113
114
) -> u64 {
114
115
let prioritization_fees = prioritization_fees
115
- . iter ( )
116
+ . into_iter ( )
116
117
. rev ( )
117
118
. take ( 20 )
118
119
. map (
119
120
|RpcPrioritizationFee {
120
121
prioritization_fee, ..
121
- } | * prioritization_fee,
122
+ } | prioritization_fee,
122
123
)
123
124
. collect :: < Vec < _ > > ( ) ;
124
125
if prioritization_fees. is_empty ( ) {
You can’t perform that action at this time.
0 commit comments