From b8b603f9bb417cb85aae55e11d415be4a5e918af Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Fri, 20 Oct 2023 14:51:28 +0200 Subject: [PATCH] More logging --- eth_defi/confirmation.py | 3 ++- eth_defi/hotwallet.py | 1 + eth_defi/provider/named.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/eth_defi/confirmation.py b/eth_defi/confirmation.py index cad4152a..2d9a0e66 100644 --- a/eth_defi/confirmation.py +++ b/eth_defi/confirmation.py @@ -478,7 +478,8 @@ def wait_and_broadcast_multiple_nodes( except TransactionNotFound as e: # Happens on LlamaNodes - we have broadcasted the transaction # but its nodes do not see it yet - logger.warning("Node missing transaction broadcast %s", tx_hash.hex()) + name = get_provider_name(web3.provider) + logger.warning("Node %s missing transaction broadcast %s", name, tx_hash.hex()) logger.exception(e) unconfirmed_tx_strs = ", ".join([tx_hash.hex() for tx_hash in unconfirmed_txs]) diff --git a/eth_defi/hotwallet.py b/eth_defi/hotwallet.py index b412f574..84c69b02 100644 --- a/eth_defi/hotwallet.py +++ b/eth_defi/hotwallet.py @@ -115,6 +115,7 @@ def address(self): def sync_nonce(self, web3: Web3): """Read the current nonce""" self.current_nonce = web3.eth.get_transaction_count(self.account.address) + logger.info("Synced nonce for %s to %d", self.account.address, self.current_nonce) def allocate_nonce(self) -> int: """Get the next free available nonce to be used with a transaction. diff --git a/eth_defi/provider/named.py b/eth_defi/provider/named.py index 069f5be3..c310e8b9 100644 --- a/eth_defi/provider/named.py +++ b/eth_defi/provider/named.py @@ -12,7 +12,7 @@ from typing import TypeAlias from web3 import HTTPProvider -from web3.providers import JSONBaseProvider +from web3.providers import JSONBaseProvider, BaseProvider from eth_defi.utils import get_url_domain @@ -49,7 +49,7 @@ def call_endpoint_uri(self) -> str: NamedProvider: TypeAlias = BaseNamedProvider | HTTPProvider -def get_provider_name(provider: NamedProvider) -> str: +def get_provider_name(provider: BaseProvider) -> str: """Get loggable name of the JSON-RPC provider. Strips out API keys from the URL of a JSON-RPC API provider.