Allow default block parameter to be blockHash (#10932)

* allow default block parameter to be blockHash

* requireCanonical

* block check takes precedence over canon check
This commit is contained in:
Seun LanLege
2019-08-06 10:08:05 +01:00
committed by David
parent 13ccb9f827
commit 72279856cd
11 changed files with 144 additions and 11 deletions

View File

@@ -1759,6 +1759,10 @@ impl BlockChainClient for Client {
self.config.spec_name.clone()
}
fn chain(&self) -> Arc<BlockProvider> {
self.chain.read().clone()
}
fn set_spec_name(&self, new_spec_name: String) -> Result<(), ()> {
trace!(target: "mode", "Client::set_spec_name({:?})", new_spec_name);
if !self.enabled.load(AtomicOrdering::Relaxed) {

View File

@@ -20,6 +20,7 @@ use std::str::FromStr;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrder};
use std::sync::Arc;
use std::collections::{HashMap, BTreeMap};
use blockchain::BlockProvider;
use std::mem;
use blockchain::{TreeRoute, BlockReceipts};
@@ -703,6 +704,10 @@ impl BlockChainClient for TestBlockChainClient {
}
}
fn chain(&self) -> Arc<BlockProvider> {
unimplemented!()
}
fn list_accounts(&self, _id: BlockId, _after: Option<&Address>, _count: u64) -> Option<Vec<Address>> {
None
}

View File

@@ -17,7 +17,7 @@
use std::collections::BTreeMap;
use std::sync::Arc;
use blockchain::{BlockReceipts, TreeRoute};
use blockchain::{BlockReceipts, TreeRoute, BlockProvider};
use bytes::Bytes;
use call_contract::{CallContract, RegistryInfo};
use ethcore_miner::pool::VerifiedTransaction;
@@ -233,6 +233,8 @@ pub trait BlockChainClient : Sync + Send + AccountData + BlockChain + CallContra
.expect("code will return Some if given BlockId::Latest; qed")
}
fn chain(&self) -> Arc<BlockProvider>;
/// Get block queue information.
fn queue_info(&self) -> BlockQueueInfo;