Skip to content

Commit 7edc787

Browse files
committed
chain/ethereum: remove unused block_hash_by_block_number method
1 parent 55ca5da commit 7edc787

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
@@ -1460,41 +1460,6 @@ impl EthereumAdapterTrait for EthereumAdapter {
14601460
})
14611461
}
14621462

1463-
async fn block_hash_by_block_number(
1464-
&self,
1465-
logger: &Logger,
1466-
block_number: BlockNumber,
1467-
) -> Result<Option<H256>, Error> {
1468-
let web3 = self.web3.clone();
1469-
let retry_log_message = format!(
1470-
"eth_getBlockByNumber RPC call for block number {}",
1471-
block_number
1472-
);
1473-
retry(retry_log_message, logger)
1474-
.redact_log_urls(true)
1475-
.no_limit()
1476-
.timeout_secs(ENV_VARS.json_rpc_timeout.as_secs())
1477-
.run(move || {
1478-
let web3 = web3.cheap_clone();
1479-
async move {
1480-
web3.eth()
1481-
.block(BlockId::Number(block_number.into()))
1482-
.await
1483-
.map(|block_opt| block_opt.and_then(|block| block.hash))
1484-
.map_err(Error::from)
1485-
}
1486-
})
1487-
.await
1488-
.map_err(move |e| {
1489-
e.into_inner().unwrap_or_else(move || {
1490-
anyhow!(
1491-
"Ethereum node took too long to return data for block #{}",
1492-
block_number
1493-
)
1494-
})
1495-
})
1496-
}
1497-
14981463
async fn get_balance(
14991464
&self,
15001465
logger: &Logger,

0 commit comments

Comments
 (0)