Skip to content

Commit 896267b

Browse files
committed
chain/ethereum: remove unused latest_block adapter method
1 parent 2debbc6 commit 896267b

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

chain/ethereum/src/adapter.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,9 +1081,6 @@ pub trait EthereumAdapter: Send + Sync + 'static {
10811081
/// connected to.
10821082
async fn net_identifiers(&self) -> Result<ChainIdentifier, Error>;
10831083

1084-
/// Get the latest block, including full transactions.
1085-
async fn latest_block(&self, logger: &Logger) -> Result<LightEthereumBlock, bc::IngestorError>;
1086-
10871084
/// Get the latest block, with only the header and transaction hashes.
10881085
async fn latest_block_ptr(&self, logger: &Logger) -> Result<BlockPtr, bc::IngestorError>;
10891086

chain/ethereum/src/ethereum_adapter.rs

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ use graph::{
3232
web3::{
3333
self,
3434
types::{
35-
BlockId, BlockNumber as Web3BlockNumber, Bytes, CallRequest, Filter, FilterBuilder,
36-
Log, Transaction, TransactionReceipt, H256,
35+
BlockId, Bytes, CallRequest, Filter, FilterBuilder, Log, Transaction,
36+
TransactionReceipt, H256,
3737
},
3838
},
3939
BlockNumber, ChainStore, CheapClone, DynTryFuture, Error, EthereumCallCache, Logger,
@@ -1334,32 +1334,6 @@ impl EthereumAdapterTrait for EthereumAdapter {
13341334
.await
13351335
}
13361336

1337-
async fn latest_block(&self, logger: &Logger) -> Result<LightEthereumBlock, IngestorError> {
1338-
let web3 = self.web3.clone();
1339-
retry("eth_getBlockByNumber(latest) with txs RPC call", logger)
1340-
.redact_log_urls(true)
1341-
.no_limit()
1342-
.timeout_secs(ENV_VARS.json_rpc_timeout.as_secs())
1343-
.run(move || {
1344-
let web3 = web3.cheap_clone();
1345-
async move {
1346-
let block_opt = web3
1347-
.eth()
1348-
.block_with_txs(Web3BlockNumber::Latest.into())
1349-
.await
1350-
.map_err(|e| anyhow!("could not get latest block from Ethereum: {}", e))?;
1351-
block_opt
1352-
.ok_or_else(|| anyhow!("no latest block returned from Ethereum").into())
1353-
}
1354-
})
1355-
.map_err(move |e| {
1356-
e.into_inner().unwrap_or_else(move || {
1357-
anyhow!("Ethereum node took too long to return latest block").into()
1358-
})
1359-
})
1360-
.await
1361-
}
1362-
13631337
async fn load_block(
13641338
&self,
13651339
logger: &Logger,

0 commit comments

Comments
 (0)