@@ -63,7 +63,15 @@ impl Miner {
63
63
64
64
// Set compute unit price
65
65
final_ixs. push ( ComputeBudgetInstruction :: set_compute_unit_price (
66
- self . priority_fee . unwrap_or ( 0 ) ,
66
+ if self . dynamic_fee {
67
+ if let Some ( dynamic_fee) = self . dynamic_fee ( ) . await {
68
+ dynamic_fee
69
+ } else {
70
+ self . priority_fee . unwrap_or ( 0 )
71
+ }
72
+ } else {
73
+ self . priority_fee . unwrap_or ( 0 )
74
+ }
67
75
) ) ;
68
76
69
77
// Add in user instructions
@@ -89,17 +97,21 @@ impl Miner {
89
97
if attempts % 10 == 0 {
90
98
// Reset the compute unit price
91
99
if self . dynamic_fee {
92
- let fee = if let Some ( fee) = self . dynamic_fee ( ) . await {
93
- progress_bar. println ( format ! ( " Priority fee: {} microlamports" , fee) ) ;
94
- fee
100
+ if let Some ( dynamic_fee) = self . dynamic_fee ( ) . await {
101
+ progress_bar. println ( format ! ( " Priority fee: {} microlamports" , dynamic_fee) ) ;
102
+ final_ixs. remove ( 1 ) ;
103
+ final_ixs. insert ( 1 , ComputeBudgetInstruction :: set_compute_unit_price ( dynamic_fee) ) ;
95
104
} else {
96
- let fee = self . priority_fee . unwrap_or ( 0 ) ;
97
- progress_bar. println ( format ! ( " {} Dynamic fees not supported by this RPC. Falling back to static value: {} microlamports" , "WARNING" . bold( ) . yellow( ) , fee) ) ;
98
- fee
99
- } ;
100
- final_ixs. remove ( 1 ) ;
101
- final_ixs. insert ( 1 , ComputeBudgetInstruction :: set_compute_unit_price ( fee) ) ;
102
- }
105
+ let fallback_fee = self . priority_fee . unwrap_or ( 0 ) ;
106
+ progress_bar. println ( format ! (
107
+ "{} Dynamic fees not supported by this RPC. Falling back to static value: {} microlamports" ,
108
+ "WARNING" . bold( ) . yellow( ) ,
109
+ fallback_fee
110
+ ) ) ;
111
+ final_ixs. remove ( 1 ) ;
112
+ final_ixs. insert ( 1 , ComputeBudgetInstruction :: set_compute_unit_price ( fallback_fee) ) ;
113
+ }
114
+ }
103
115
104
116
// Resign the tx
105
117
let ( hash, _slot) = client
0 commit comments