Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a gas price strategy that's closer to ethgasstation #6135

Merged
merged 1 commit into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions raiden/network/rpc/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools

from cachetools import LRUCache
from web3.gas_strategies.time_based import construct_time_based_gas_price_strategy
from web3.middleware.cache import construct_simple_cache_middleware
from web3.types import RPCEndpoint

Expand All @@ -12,3 +13,7 @@
cache_class=functools.partial(LRUCache, 150), # type: ignore
rpc_whitelist=BLOCK_HASH_CACHE_RPC_WHITELIST,
)

faster_gas_price_strategy = construct_time_based_gas_price_strategy(
max_wait_seconds=15, sample_size=120, probability=99
)
7 changes: 4 additions & 3 deletions raiden/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
from click._compat import term_len
from click.formatting import iter_rows, measure_table, wrap_text
from pytoml import TomlError, load
from web3.gas_strategies.time_based import fast_gas_price_strategy, medium_gas_price_strategy
from web3.gas_strategies.time_based import fast_gas_price_strategy

from raiden.exceptions import ConfigurationError, InvalidChecksummedAddress
from raiden.network.rpc.middleware import faster_gas_price_strategy
from raiden.utils.formatting import address_checksum_and_decode
from raiden_contracts.constants import CHAINNAME_TO_ID

Expand Down Expand Up @@ -302,9 +303,9 @@ def fixed_gas_price_strategy(_web3, _transaction_params):
else:
gas_price_string = super().convert(value, param, ctx)
if gas_price_string == "fast":
return fast_gas_price_strategy
return faster_gas_price_strategy
else:
return medium_gas_price_strategy
return fast_gas_price_strategy


class MatrixServerType(click.Choice):
Expand Down