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
from cic_eth.error import SeppukuError
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()
@ -41,21 +41,20 @@ class BaseTask(celery.Task):
def create_gas_oracle(self, conn, address=None, *args, **kwargs):
if address == None:
return RPCGasOracle(
x = None
if address is None:
x = RPCGasOracle(
conn,
code_callback=kwargs.get('code_callback', self.get_min_fee_limit),
min_price=self.min_fee_price,
id_generator=kwargs.get('id_generator'),
)
else:
return CacheGasOracle(
conn,
address,
method=kwargs.get('method'),
min_price=self.min_fee_price,
id_generator=kwargs.get('id_generator'),
)
x = MaxGasOracle(conn)
x.code_callback = x.get_fee_units
return x
def get_min_fee_limit(self, code):