Default to max gas oracle.

This commit is contained in:
philip 2022-01-04 18:39:08 +03:00
parent f67702cc79
commit 9398cd98d0
Signed by untrusted user: mango-habanero
GPG Key ID: B00CE9034DA19FB7

View File

@ -17,7 +17,7 @@ from cic_eth_registry.error import UnknownContractError
# local imports # local imports
from cic_eth.error import SeppukuError from cic_eth.error import SeppukuError
from cic_eth.db.models.base import SessionBase from cic_eth.db.models.base import SessionBase
from cic_eth.eth.util import CacheGasOracle from cic_eth.eth.util import CacheGasOracle, MaxGasOracle
#logg = logging.getLogger().getChild(__name__) #logg = logging.getLogger().getChild(__name__)
logg = logging.getLogger() logg = logging.getLogger()
@ -41,21 +41,20 @@ class BaseTask(celery.Task):
def create_gas_oracle(self, conn, address=None, *args, **kwargs): def create_gas_oracle(self, conn, address=None, *args, **kwargs):
if address == None: x = None
return RPCGasOracle( if address is None:
x = RPCGasOracle(
conn, conn,
code_callback=kwargs.get('code_callback', self.get_min_fee_limit), code_callback=kwargs.get('code_callback', self.get_min_fee_limit),
min_price=self.min_fee_price, min_price=self.min_fee_price,
id_generator=kwargs.get('id_generator'), id_generator=kwargs.get('id_generator'),
) )
else:
return CacheGasOracle( x = MaxGasOracle(conn)
conn, x.code_callback = x.get_fee_units
address,
method=kwargs.get('method'), return x
min_price=self.min_fee_price,
id_generator=kwargs.get('id_generator'),
)
def get_min_fee_limit(self, code): def get_min_fee_limit(self, code):