Skip to content

Commit 8a34bbc

Browse files
committed
refactored function name: queued_transaction_if_readable to transaction_if_readable
1 parent dd7f889 commit 8a34bbc

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

crates/ethcore/src/client/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,7 @@ impl BlockChainClient for Client {
24262426
self.importer.miner.transaction(&hash)
24272427
}
24282428

2429-
fn queued_transaction_if_readable(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>> {
2429+
fn transaction_if_readable(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>> {
24302430
self.importer.miner.transaction_if_readable(&hash)
24312431
}
24322432

crates/ethcore/src/client/test_client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,10 @@ impl BlockChainClient for TestBlockChainClient {
11601160
self.miner.transaction(tx_hash)
11611161
}
11621162

1163+
fn transaction_if_readable(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>> {
1164+
self.miner.transaction_if_readable(hash)
1165+
}
1166+
11631167
/// Returns the devp2p network endpoint IP and Port information that is used to communicate with other peers.
11641168
11651169
fn reserved_peers_management(&self) -> &Mutex<Option<Box<dyn ReservedPeersManagement>>> {

crates/ethcore/src/client/traits.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,6 @@ pub trait BlockChainClient:
353353
/// Get pool transaction with a given hash.
354354
fn queued_transaction(&self, hash: H256) -> Option<Arc<VerifiedTransaction>>;
355355

356-
/// see queued_transactions(&self).
357-
/// Get pool transaction with a given hash, but returns NONE fast, if if cannot acquire a readlock fast.
358-
fn queued_transaction_if_readable(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>;
359-
360356
/// Get uncle with given id.
361357
fn uncle(&self, id: UncleId) -> Option<encoded::Header>;
362358

@@ -427,6 +423,10 @@ pub trait BlockChainClient:
427423
/// Get verified transaction with specified transaction hash.
428424
fn transaction(&self, tx_hash: &H256) -> Option<Arc<VerifiedTransaction>>;
429425

426+
/// see queued_transactions(&self).
427+
/// Get pool transaction with a given hash, but returns NONE fast, if if cannot acquire a readlock fast.
428+
fn transaction_if_readable(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>;
429+
430430
/// Sorted list of transaction gas prices from at least last sample_size blocks.
431431
fn gas_price_corpus(&self, sample_size: usize) -> ::stats::Corpus<U256> {
432432
let mut h = self.chain_info().best_block_hash;

crates/ethcore/sync/src/chain/handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ impl SyncHandler {
868868

869869
// if we cant read the pool here, we are asuming we dont know the transaction yet.
870870
// in the worst case we are refetching a transaction that we already have.
871-
if io.chain().queued_transaction_if_readable(&hash).is_none() {
871+
if io.chain().transaction_if_readable(&hash).is_none() {
872872
sync.peers
873873
.get_mut(&peer_id)
874874
.map(|peer| peer.unfetched_pooled_transactions.insert(hash));

crates/ethcore/sync/src/chain/supplier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl SyncSupplier {
323323
// we do not lock here, if we cannot access the memory at this point in time,
324324
// we will just skip this transaction, otherwise the other peer might wait to long, resulting in a timeout.
325325
// also this solved a potential deadlock situation:
326-
if let Some(tx) = io.chain().queued_transaction_if_readable(&hash) {
326+
if let Some(tx) = io.chain().transaction_if_readable(&hash) {
327327
tx.signed().rlp_append(&mut rlp);
328328
added += 1;
329329
if rlp.len() > PAYLOAD_SOFT_LIMIT {

0 commit comments

Comments
 (0)