beta 2.5.1 (#10643)
* version: bump beta to 2.5.1 * fix(whisper expiry): current time + work + ttl (#10587) * update bootnodes (#10595) * config: update goerli bootnodes * config: update kotti bootnodes * adds rpc error message for --no-ancient-blocks (#10608) * adds error message for --no-ancient-blocks, closes #10261 * Apply suggestions from code review Co-Authored-By: seunlanlege <seunlanlege@gmail.com> * Constantinople HF on POA Core (#10606) * Constantinople HF on POA Core Plan Constantinople/St.Petersfork HF on POA Core network at block 8582254. Original PR in POA repository: https://github.com/poanetwork/poa-chain-spec/pull/110 * Remove extra empty line * evm: add some mulmod benches (#10600) * evm: add blockhash_mulmod bench * evm: use num-bigint for mod ops * Clique: zero-fill extradata when the supplied value is less than 32 bytes in length (#10605) * Update kovan.json to switch validator set to POA Consensus Contracts (#10628) * Fix publish docs (#10635) * Fix publish docs * this never should be forced, either way compiling previous versions will produce outdated docs * fix array, var was moved to the group project global variables list * Fix rinkeby petersburg fork (#10632)
This commit is contained in:
@@ -29,6 +29,7 @@ use light::on_demand::error::{Error as OnDemandError, ErrorKind as OnDemandError
|
||||
use ethcore::client::BlockChainClient;
|
||||
use types::blockchain_info::BlockChainInfo;
|
||||
use v1::types::BlockNumber;
|
||||
use v1::impls::EthClientOptions;
|
||||
|
||||
mod codes {
|
||||
// NOTE [ToDr] Codes from [-32099, -32000]
|
||||
@@ -221,18 +222,34 @@ pub fn cannot_submit_work(err: EthcoreError) -> Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unavailable_block() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: "Ancient block sync is still in progress".into(),
|
||||
data: None,
|
||||
pub fn unavailable_block(no_ancient_block: bool, by_hash: bool) -> Error {
|
||||
if no_ancient_block {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: "Looks like you disabled ancient block download, unfortunately the information you're \
|
||||
trying to fetch doesn't exist in the db and is probably in the ancient blocks.".into(),
|
||||
data: None,
|
||||
}
|
||||
} else if by_hash {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: "Block information is incomplete while ancient block sync is still in progress, before \
|
||||
it's finished we can't determine the existence of requested item.".into(),
|
||||
data: None,
|
||||
}
|
||||
} else {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: "Requested block number is in a range that is not available yet, because the ancient block sync is still in progress.".into(),
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_block_number_existence<'a, T, C>(
|
||||
client: &'a C,
|
||||
num: BlockNumber,
|
||||
allow_missing_blocks: bool,
|
||||
options: EthClientOptions,
|
||||
) ->
|
||||
impl Fn(Option<T>) -> RpcResult<Option<T>> + 'a
|
||||
where C: BlockChainClient,
|
||||
@@ -242,8 +259,8 @@ pub fn check_block_number_existence<'a, T, C>(
|
||||
if let BlockNumber::Num(block_number) = num {
|
||||
// tried to fetch block number and got nothing even though the block number is
|
||||
// less than the latest block number
|
||||
if block_number < client.chain_info().best_block_number && !allow_missing_blocks {
|
||||
return Err(unavailable_block());
|
||||
if block_number < client.chain_info().best_block_number && !options.allow_missing_blocks {
|
||||
return Err(unavailable_block(options.no_ancient_blocks, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,22 +270,17 @@ pub fn check_block_number_existence<'a, T, C>(
|
||||
|
||||
pub fn check_block_gap<'a, T, C>(
|
||||
client: &'a C,
|
||||
allow_missing_blocks: bool,
|
||||
options: EthClientOptions,
|
||||
) -> impl Fn(Option<T>) -> RpcResult<Option<T>> + 'a
|
||||
where C: BlockChainClient,
|
||||
{
|
||||
move |response| {
|
||||
if response.is_none() && !allow_missing_blocks {
|
||||
if response.is_none() && !options.allow_missing_blocks {
|
||||
let BlockChainInfo { ancient_block_hash, .. } = client.chain_info();
|
||||
// block information was requested, but unfortunately we couldn't find it and there
|
||||
// are gaps in the database ethcore/src/blockchain/blockchain.rs
|
||||
if ancient_block_hash.is_some() {
|
||||
return Err(Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: "Block information is incomplete while ancient block sync is still in progress, before \
|
||||
it's finished we can't determine the existence of requested item.".into(),
|
||||
data: None,
|
||||
})
|
||||
return Err(unavailable_block(options.no_ancient_blocks, true))
|
||||
}
|
||||
}
|
||||
Ok(response)
|
||||
|
||||
Reference in New Issue
Block a user