Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 270eee9

Browse files
authored
Merge pull request #308 from bancorprotocol/307-max-priority-fee-input-overridden-when-handling-incorrect-base-fee-input-error
Fix max_priority usage in txhelpers & pool_shutdown
2 parents a3448e4 + 2feedd0 commit 270eee9

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

fastlane_bot/helpers/txhelpers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,12 @@ def build_transaction_with_gas(
611611
split1 = message.split("maxFeePerGas: ")[1]
612612
split2 = split1.split(" baseFee: ")
613613
split_baseFee = int(int(split2[1].split(" (supplied gas")[0]))
614-
split_maxPriorityFeePerGas = int(
615-
int(split2[0]) * self.ConfigObj.DEFAULT_GAS_PRICE_OFFSET
616-
)
617614
transaction = self.construct_contract_function(
618615
routes=routes,
619616
src_amt=src_amt,
620617
src_address=src_address,
621618
gas_price=split_baseFee,
622-
max_priority=split_maxPriorityFeePerGas,
619+
max_priority=max_priority,
623620
nonce=nonce,
624621
flashloan_struct=flashloan_struct,
625622
)

fastlane_bot/tools/pool_shutdown.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,23 @@ def build_transaction(
235235
)
236236
if "max fee per gas less than block base fee" in str(e):
237237
try:
238-
return self._build_transaction(e, tkn, nonce)
238+
return self._build_transaction(e, max_priority_gas, tkn, nonce)
239239
except Exception as e:
240240
self.mgr.cfg.logger.debug(
241241
f"(***2***) Error when building transaction: {e.__class__.__name__} {e}"
242242
)
243243
return None
244244

245-
def _build_transaction(self, e: Exception, tkn: str, nonce: int):
245+
def _build_transaction(self, e: Exception, max_priority: int, tkn: str, nonce: int):
246246
"""
247247
Handles the transaction generation logic.
248248
249249
Parameters
250250
----------
251251
e: Exception
252252
The exception
253+
max_priority: int
254+
The max priority fee input
253255
tkn: str
254256
The token address
255257
nonce: int
@@ -265,15 +267,12 @@ def _build_transaction(self, e: Exception, tkn: str, nonce: int):
265267
split1 = message.split("maxFeePerGas: ")[1]
266268
split2 = split1.split(" baseFee: ")
267269
split_base_fee = int(split2[1].split(" (supplied gas")[0])
268-
split_max_priority_fee_per_gas = int(
269-
int(split2[0]) * self.mgr.cfg.DEFAULT_GAS_PRICE_OFFSET
270-
)
271270
return self.bancor_network_contract.functions.withdrawPOL(
272271
self.mgr.web3.to_checksum_address(tkn)
273272
).build_transaction(
274273
self.tx_helpers.build_tx(
275274
base_gas_price=split_base_fee,
276-
max_priority_fee=split_max_priority_fee_per_gas,
275+
max_priority_fee=max_priority,
277276
nonce=nonce,
278277
)
279278
)

0 commit comments

Comments
 (0)