Skip to content

Commit 2374d17

Browse files
committed
chain/ethereum: remove unused block_hash_by_block_number method
1 parent 17b94b9 commit 2374d17

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

chain/ethereum/src/adapter.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,21 +1124,6 @@ pub trait EthereumAdapter: Send + Sync + 'static {
11241124
block: LightEthereumBlock,
11251125
) -> Result<EthereumBlock, bc::IngestorError>;
11261126

1127-
/// Find a block by its number, according to the Ethereum node.
1128-
///
1129-
/// Careful: don't use this function without considering race conditions.
1130-
/// Chain reorgs could happen at any time, and could affect the answer received.
1131-
/// Generally, it is only safe to use this function with blocks that have received enough
1132-
/// confirmations to guarantee no further reorgs, **and** where the Ethereum node is aware of
1133-
/// those confirmations.
1134-
/// If the Ethereum node is far behind in processing blocks, even old blocks can be subject to
1135-
/// reorgs.
1136-
async fn block_hash_by_block_number(
1137-
&self,
1138-
logger: &Logger,
1139-
block_number: BlockNumber,
1140-
) -> Result<Option<H256>, Error>;
1141-
11421127
/// Finds the hash and number of the lowest non-null block with height greater than or equal to
11431128
/// the given number.
11441129
///

chain/ethereum/src/ethereum_adapter.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,41 +1475,6 @@ impl EthereumAdapterTrait for EthereumAdapter {
14751475
})
14761476
}
14771477

1478-
async fn block_hash_by_block_number(
1479-
&self,
1480-
logger: &Logger,
1481-
block_number: BlockNumber,
1482-
) -> Result<Option<H256>, Error> {
1483-
let web3 = self.web3.clone();
1484-
let retry_log_message = format!(
1485-
"eth_getBlockByNumber RPC call for block number {}",
1486-
block_number
1487-
);
1488-
retry(retry_log_message, logger)
1489-
.redact_log_urls(true)
1490-
.no_limit()
1491-
.timeout_secs(ENV_VARS.json_rpc_timeout.as_secs())
1492-
.run(move || {
1493-
let web3 = web3.cheap_clone();
1494-
async move {
1495-
web3.eth()
1496-
.block(BlockId::Number(block_number.into()))
1497-
.await
1498-
.map(|block_opt| block_opt.and_then(|block| block.hash))
1499-
.map_err(Error::from)
1500-
}
1501-
})
1502-
.await
1503-
.map_err(move |e| {
1504-
e.into_inner().unwrap_or_else(move || {
1505-
anyhow!(
1506-
"Ethereum node took too long to return data for block #{}",
1507-
block_number
1508-
)
1509-
})
1510-
})
1511-
}
1512-
15131478
async fn get_balance(
15141479
&self,
15151480
logger: &Logger,

0 commit comments

Comments
 (0)