Unknown block error for RPC (#3965)
This commit is contained in:
committed by
Gav Wood
parent
612f14188f
commit
546246c56b
@@ -619,7 +619,8 @@ impl Client {
|
||||
/// Attempt to get a copy of a specific block's final state.
|
||||
///
|
||||
/// This will not fail if given BlockId::Latest.
|
||||
/// Otherwise, this can fail (but may not) if the DB prunes state.
|
||||
/// Otherwise, this can fail (but may not) if the DB prunes state or the block
|
||||
/// is unknown.
|
||||
pub fn state_at(&self, id: BlockId) -> Option<State> {
|
||||
// fast path for latest state.
|
||||
match id.clone() {
|
||||
|
||||
@@ -523,7 +523,8 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
match id {
|
||||
BlockId::Number(number) if (number as usize) < self.blocks.read().len() => BlockStatus::InChain,
|
||||
BlockId::Hash(ref hash) if self.blocks.read().get(hash).is_some() => BlockStatus::InChain,
|
||||
_ => BlockStatus::Unknown
|
||||
BlockId::Latest | BlockId::Pending | BlockId::Earliest => BlockStatus::InChain,
|
||||
_ => BlockStatus::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ pub trait BlockChainClient : Sync + Send {
|
||||
/// Get the address of the registry itself.
|
||||
fn registrar_address(&self) -> Option<Address>;
|
||||
|
||||
/// Get the address of a particular blockchain service, if available.
|
||||
/// Get the address of a particular blockchain service, if available.
|
||||
fn registry_address(&self, name: String) -> Option<Address>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user