Backporting to stable (#6060)

* --reseal-on-uncle (#5940)

* --reseal-on-uncle

* Optimized uncle check

* Additional uncle check

* Updated comment

* v1.6.9

* CLI: Export error message and less verbose peer counter. (#5870)

* Removed numbed of active connections from informant

* Print error message when fatdb is required

* Remove peers from UI
This commit is contained in:
Arkadiy Paronyan 2017-07-14 17:42:36 +02:00 committed by GitHub
parent 823f207d25
commit 1f176c7798
19 changed files with 109 additions and 44 deletions

50
Cargo.lock generated
View File

@ -1,6 +1,6 @@
[root] [root]
name = "parity" name = "parity"
version = "1.6.8" version = "1.6.9"
dependencies = [ dependencies = [
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -23,7 +23,7 @@ dependencies = [
"ethcore-secretstore 1.0.0", "ethcore-secretstore 1.0.0",
"ethcore-signer 1.6.0", "ethcore-signer 1.6.0",
"ethcore-stratum 1.6.0", "ethcore-stratum 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethsync 1.6.0", "ethsync 1.6.0",
"evmbin 0.1.0", "evmbin 0.1.0",
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -394,7 +394,7 @@ dependencies = [
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-ipc-nano 1.6.0", "ethcore-ipc-nano 1.6.0",
"ethcore-stratum 1.6.0", "ethcore-stratum 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethjson 0.1.0", "ethjson 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"ethstore 0.1.0", "ethstore 0.1.0",
@ -444,7 +444,7 @@ dependencies = [
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
"ethcore-rpc 1.6.0", "ethcore-rpc 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
@ -492,7 +492,7 @@ name = "ethcore-ipc"
version = "1.6.0" version = "1.6.0"
dependencies = [ dependencies = [
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)",
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -539,7 +539,7 @@ dependencies = [
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-ipc-nano 1.6.0", "ethcore-ipc-nano 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)",
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -554,7 +554,7 @@ dependencies = [
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-network 1.6.0", "ethcore-network 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -570,7 +570,7 @@ name = "ethcore-logger"
version = "1.6.0" version = "1.6.0"
dependencies = [ dependencies = [
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -586,7 +586,7 @@ dependencies = [
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
"ethcore-io 1.6.0", "ethcore-io 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -614,7 +614,7 @@ dependencies = [
"ethcore-io 1.6.0", "ethcore-io 1.6.0",
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-light 1.6.0", "ethcore-light 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethjson 0.1.0", "ethjson 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
@ -649,7 +649,7 @@ dependencies = [
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-ipc-nano 1.6.0", "ethcore-ipc-nano 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -667,7 +667,7 @@ dependencies = [
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
"ethcore-io 1.6.0", "ethcore-io 1.6.0",
"ethcore-rpc 1.6.0", "ethcore-rpc 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"jsonrpc-core 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)", "jsonrpc-core 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -686,7 +686,7 @@ dependencies = [
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-ipc-nano 1.6.0", "ethcore-ipc-nano 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)", "jsonrpc-core 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)",
"jsonrpc-macros 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)", "jsonrpc-macros 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)",
@ -700,7 +700,7 @@ dependencies = [
[[package]] [[package]]
name = "ethcore-util" name = "ethcore-util"
version = "1.6.8" version = "1.6.9"
dependencies = [ dependencies = [
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -749,7 +749,7 @@ dependencies = [
name = "ethjson" name = "ethjson"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -777,7 +777,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -810,7 +810,7 @@ dependencies = [
"ethcore-ipc-nano 1.6.0", "ethcore-ipc-nano 1.6.0",
"ethcore-light 1.6.0", "ethcore-light 1.6.0",
"ethcore-network 1.6.0", "ethcore-network 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethkey 0.2.0", "ethkey 0.2.0",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -828,7 +828,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.6.0", "ethcore 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1084,7 +1084,7 @@ version = "1.6.0"
dependencies = [ dependencies = [
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1687,7 +1687,7 @@ name = "parity-hash-fetch"
version = "1.6.0" version = "1.6.0"
dependencies = [ dependencies = [
"ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1704,7 +1704,7 @@ version = "1.6.0"
dependencies = [ dependencies = [
"cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.6.0", "ethcore 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
"jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)",
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1718,7 +1718,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"ethcore 1.6.0", "ethcore 1.6.0",
"ethcore-io 1.6.0", "ethcore-io 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethkey 0.2.0", "ethkey 0.2.0",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.1.0", "rlp 0.1.0",
@ -1741,7 +1741,7 @@ version = "1.4.0"
dependencies = [ dependencies = [
"ethcore-rpc 1.6.0", "ethcore-rpc 1.6.0",
"ethcore-signer 1.6.0", "ethcore-signer 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)", "jsonrpc-core 6.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.6)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1785,7 +1785,7 @@ dependencies = [
"ethcore 1.6.0", "ethcore 1.6.0",
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"ethsync 1.6.0", "ethsync 1.6.0",
"ipc-common-types 1.6.0", "ipc-common-types 1.6.0",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2084,7 +2084,7 @@ version = "1.4.0"
dependencies = [ dependencies = [
"ethcore-bigint 0.1.2", "ethcore-bigint 0.1.2",
"ethcore-rpc 1.6.0", "ethcore-rpc 1.6.0",
"ethcore-util 1.6.8", "ethcore-util 1.6.9",
"futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-rpc-client 1.4.0", "parity-rpc-client 1.4.0",
"rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,7 +1,7 @@
[package] [package]
description = "Parity Ethereum client" description = "Parity Ethereum client"
name = "parity" name = "parity"
version = "1.6.8" version = "1.6.9"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -1532,6 +1532,33 @@ impl MiningBlockChainClient for Client {
open_block open_block
} }
fn reopen_block(&self, block: ClosedBlock) -> OpenBlock {
let engine = &*self.engine;
let mut block = block.reopen(engine);
let max_uncles = engine.maximum_uncle_count();
if block.uncles().len() < max_uncles {
let chain = self.chain.read();
let h = chain.best_block_hash();
// Add new uncles
let uncles = chain
.find_uncle_hashes(&h, engine.maximum_uncle_age())
.unwrap_or_else(Vec::new);
for h in uncles {
if !block.uncles().iter().any(|header| header.hash() == h) {
let uncle = chain.block_header(&h).expect("find_uncle_hashes only returns hashes for existing headers; qed");
block.push_uncle(uncle).expect("pushing up to maximum_uncle_count;
push_uncle is not ok only if more than maximum_uncle_count is pushed;
so all push_uncle are Ok;
qed");
if block.uncles().len() >= max_uncles { break }
}
}
}
block
}
fn vm_factory(&self) -> &EvmFactory { fn vm_factory(&self) -> &EvmFactory {
&self.factories.vm &self.factories.vm
} }

View File

@ -42,7 +42,7 @@ use types::mode::Mode;
use types::pruning_info::PruningInfo; use types::pruning_info::PruningInfo;
use verification::queue::QueueInfo; use verification::queue::QueueInfo;
use block::{OpenBlock, SealedBlock}; use block::{OpenBlock, SealedBlock, ClosedBlock};
use executive::Executed; use executive::Executed;
use error::CallError; use error::CallError;
use trace::LocalizedTrace; use trace::LocalizedTrace;
@ -378,6 +378,10 @@ impl MiningBlockChainClient for TestBlockChainClient {
open_block open_block
} }
fn reopen_block(&self, block: ClosedBlock) -> OpenBlock {
block.reopen(&*self.spec.engine)
}
fn vm_factory(&self) -> &EvmFactory { fn vm_factory(&self) -> &EvmFactory {
&self.vm_factory &self.vm_factory
} }

View File

@ -18,7 +18,7 @@ use std::collections::BTreeMap;
use util::{U256, Address, H256, H2048, Bytes, Itertools}; use util::{U256, Address, H256, H2048, Bytes, Itertools};
use blockchain::TreeRoute; use blockchain::TreeRoute;
use verification::queue::QueueInfo as BlockQueueInfo; use verification::queue::QueueInfo as BlockQueueInfo;
use block::{OpenBlock, SealedBlock}; use block::{OpenBlock, SealedBlock, ClosedBlock};
use header::{BlockNumber}; use header::{BlockNumber};
use transaction::{LocalizedTransaction, PendingTransaction, SignedTransaction}; use transaction::{LocalizedTransaction, PendingTransaction, SignedTransaction};
use transaction_import::TransactionImportResult; use transaction_import::TransactionImportResult;
@ -277,6 +277,9 @@ pub trait MiningBlockChainClient: BlockChainClient {
extra_data: Bytes extra_data: Bytes
) -> OpenBlock; ) -> OpenBlock;
/// Reopens an OpenBlock and updates uncles.
fn reopen_block(&self, block: ClosedBlock) -> OpenBlock;
/// Returns EvmFactory. /// Returns EvmFactory.
fn vm_factory(&self) -> &EvmFactory; fn vm_factory(&self) -> &EvmFactory;

View File

@ -129,6 +129,8 @@ pub enum BlockError {
UncleIsBrother(OutOfBounds<BlockNumber>), UncleIsBrother(OutOfBounds<BlockNumber>),
/// An uncle is already in the chain. /// An uncle is already in the chain.
UncleInChain(H256), UncleInChain(H256),
/// An uncle is included twice.
DuplicateUncle(H256),
/// An uncle has a parent not in the chain. /// An uncle has a parent not in the chain.
UncleParentNotInChain(H256), UncleParentNotInChain(H256),
/// State root header field is invalid. /// State root header field is invalid.
@ -184,6 +186,7 @@ impl fmt::Display for BlockError {
UncleTooOld(ref oob) => format!("Uncle block is too old. {}", oob), UncleTooOld(ref oob) => format!("Uncle block is too old. {}", oob),
UncleIsBrother(ref oob) => format!("Uncle from same generation as block. {}", oob), UncleIsBrother(ref oob) => format!("Uncle from same generation as block. {}", oob),
UncleInChain(ref hash) => format!("Uncle {} already in chain", hash), UncleInChain(ref hash) => format!("Uncle {} already in chain", hash),
DuplicateUncle(ref hash) => format!("Uncle {} already in the header", hash),
UncleParentNotInChain(ref hash) => format!("Uncle {} has a parent not in the chain", hash), UncleParentNotInChain(ref hash) => format!("Uncle {} has a parent not in the chain", hash),
InvalidStateRoot(ref mis) => format!("Invalid state root in header: {}", mis), InvalidStateRoot(ref mis) => format!("Invalid state root in header: {}", mis),
InvalidGasUsed(ref mis) => format!("Invalid gas used in header: {}", mis), InvalidGasUsed(ref mis) => format!("Invalid gas used in header: {}", mis),

View File

@ -88,6 +88,8 @@ pub struct MinerOptions {
pub reseal_on_external_tx: bool, pub reseal_on_external_tx: bool,
/// Reseal on receipt of new local transactions. /// Reseal on receipt of new local transactions.
pub reseal_on_own_tx: bool, pub reseal_on_own_tx: bool,
/// Reseal when new uncle block has been imported.
pub reseal_on_uncle: bool,
/// Minimum period between transaction-inspired reseals. /// Minimum period between transaction-inspired reseals.
pub reseal_min_period: Duration, pub reseal_min_period: Duration,
/// Maximum amount of gas to bother considering for block insertion. /// Maximum amount of gas to bother considering for block insertion.
@ -117,6 +119,7 @@ impl Default for MinerOptions {
force_sealing: false, force_sealing: false,
reseal_on_external_tx: false, reseal_on_external_tx: false,
reseal_on_own_tx: true, reseal_on_own_tx: true,
reseal_on_uncle: false,
tx_gas_limit: !U256::zero(), tx_gas_limit: !U256::zero(),
tx_queue_size: 1024, tx_queue_size: 1024,
tx_queue_gas_limit: GasLimit::Auto, tx_queue_gas_limit: GasLimit::Auto,
@ -339,7 +342,7 @@ impl Miner {
Some(old_block) => { Some(old_block) => {
trace!(target: "miner", "prepare_block: Already have previous work; updating and returning"); trace!(target: "miner", "prepare_block: Already have previous work; updating and returning");
// add transactions to old_block // add transactions to old_block
old_block.reopen(&*self.engine) chain.reopen_block(old_block)
} }
None => { None => {
// block not found - create it. // block not found - create it.
@ -358,7 +361,6 @@ impl Miner {
let mut transactions_to_penalize = HashSet::new(); let mut transactions_to_penalize = HashSet::new();
let block_number = open_block.block().fields().header.number(); let block_number = open_block.block().fields().header.number();
// TODO Push new uncles too.
let mut tx_count: usize = 0; let mut tx_count: usize = 0;
let tx_total = transactions.len(); let tx_total = transactions.len();
for tx in transactions { for tx in transactions {
@ -1142,11 +1144,10 @@ impl MinerService for Miner {
}) })
} }
fn chain_new_blocks(&self, chain: &MiningBlockChainClient, _imported: &[H256], _invalid: &[H256], enacted: &[H256], retracted: &[H256]) { fn chain_new_blocks(&self, chain: &MiningBlockChainClient, imported: &[H256], _invalid: &[H256], enacted: &[H256], retracted: &[H256]) {
trace!(target: "miner", "chain_new_blocks"); trace!(target: "miner", "chain_new_blocks");
// 1. We ignore blocks that were `imported` (because it means that they are not in canon-chain, and transactions // 1. We ignore blocks that were `imported` unless resealing on new uncles is enabled.
// should be still available in the queue.
// 2. We ignore blocks that are `invalid` because it doesn't have any meaning in terms of the transactions that // 2. We ignore blocks that are `invalid` because it doesn't have any meaning in terms of the transactions that
// are in those blocks // are in those blocks
@ -1181,7 +1182,7 @@ impl MinerService for Miner {
transaction_queue.remove_old(&fetch_account, time); transaction_queue.remove_old(&fetch_account, time);
} }
if enacted.len() > 0 { if enacted.len() > 0 || (imported.len() > 0 && self.options.reseal_on_uncle) {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// | NOTE Code below requires transaction_queue and sealing_work locks. | // | NOTE Code below requires transaction_queue and sealing_work locks. |
// | Make sure to release the locks before calling that method. | // | Make sure to release the locks before calling that method. |
@ -1300,6 +1301,7 @@ mod tests {
force_sealing: false, force_sealing: false,
reseal_on_external_tx: false, reseal_on_external_tx: false,
reseal_on_own_tx: true, reseal_on_own_tx: true,
reseal_on_uncle: false,
reseal_min_period: Duration::from_secs(5), reseal_min_period: Duration::from_secs(5),
tx_gas_limit: !U256::zero(), tx_gas_limit: !U256::zero(),
tx_queue_size: 1024, tx_queue_size: 1024,

View File

@ -124,12 +124,17 @@ pub fn verify_block_family(header: &Header, bytes: &[u8], engine: &Engine, bc: &
} }
} }
let mut verified = HashSet::new();
for uncle in UntrustedRlp::new(bytes).at(2)?.iter().map(|rlp| rlp.as_val::<Header>()) { for uncle in UntrustedRlp::new(bytes).at(2)?.iter().map(|rlp| rlp.as_val::<Header>()) {
let uncle = uncle?; let uncle = uncle?;
if excluded.contains(&uncle.hash()) { if excluded.contains(&uncle.hash()) {
return Err(From::from(BlockError::UncleInChain(uncle.hash()))) return Err(From::from(BlockError::UncleInChain(uncle.hash())))
} }
if verified.contains(&uncle.hash()) {
return Err(From::from(BlockError::DuplicateUncle(uncle.hash())))
}
// m_currentBlock.number() - uncle.number() m_cB.n - uP.n() // m_currentBlock.number() - uncle.number() m_cB.n - uP.n()
// 1 2 // 1 2
// 2 // 2
@ -172,6 +177,7 @@ pub fn verify_block_family(header: &Header, bytes: &[u8], engine: &Engine, bc: &
verify_parent(&uncle, &uncle_parent)?; verify_parent(&uncle, &uncle_parent)?;
engine.verify_block_family(&uncle, &uncle_parent, Some(bytes))?; engine.verify_block_family(&uncle, &uncle_parent, Some(bytes))?;
verified.insert(uncle.hash());
} }
} }
Ok(()) Ok(())
@ -555,6 +561,11 @@ mod tests {
check_fail(family_test(&create_test_block_with_data(&header, &good_transactions, &bad_uncles), engine, &bc), check_fail(family_test(&create_test_block_with_data(&header, &good_transactions, &bad_uncles), engine, &bc),
TooManyUncles(OutOfBounds { max: Some(engine.maximum_uncle_count()), min: None, found: bad_uncles.len() })); TooManyUncles(OutOfBounds { max: Some(engine.maximum_uncle_count()), min: None, found: bad_uncles.len() }));
header = good.clone();
bad_uncles = vec![ good_uncle1.clone(), good_uncle1.clone() ];
check_fail(family_test(&create_test_block_with_data(&header, &good_transactions, &bad_uncles), engine, &bc),
DuplicateUncle(good_uncle1.hash()));
// TODO: some additional uncle checks // TODO: some additional uncle checks
} }
} }

View File

@ -49,7 +49,7 @@ class Status extends Component {
{ netChain } { netChain }
</div> </div>
<div className={ styles.peers }> <div className={ styles.peers }>
{ netPeers.active.toFormat() }/{ netPeers.connected.toFormat() }/{ netPeers.max.toFormat() } peers { netPeers.connected.toFormat() }/{ netPeers.max.toFormat() } peers
</div> </div>
</div> </div>
</div> </div>

View File

@ -462,7 +462,7 @@
<key>OVERWRITE_PERMISSIONS</key> <key>OVERWRITE_PERMISSIONS</key>
<false/> <false/>
<key>VERSION</key> <key>VERSION</key>
<string>1.6.8</string> <string>1.6.9</string>
</dict> </dict>
<key>UUID</key> <key>UUID</key>
<string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string> <string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.6.8</string> <string>1.6.9</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>

View File

@ -10,7 +10,7 @@
!define DESCRIPTION "Fast, light, robust Ethereum implementation" !define DESCRIPTION "Fast, light, robust Ethereum implementation"
!define VERSIONMAJOR 1 !define VERSIONMAJOR 1
!define VERSIONMINOR 6 !define VERSIONMINOR 6
!define VERSIONBUILD 8 !define VERSIONBUILD 9
!define ARGS "--warp" !define ARGS "--warp"
!define FIRST_START_ARGS "ui --warp --mode=passive" !define FIRST_START_ARGS "ui --warp --mode=passive"

View File

@ -319,7 +319,8 @@ fn start_client(
fat_db: Switch, fat_db: Switch,
compaction: DatabaseCompactionProfile, compaction: DatabaseCompactionProfile,
wal: bool, wal: bool,
cache_config: CacheConfig cache_config: CacheConfig,
require_fat_db: bool,
) -> Result<ClientService, String> { ) -> Result<ClientService, String> {
// load spec file // load spec file
@ -347,6 +348,9 @@ fn start_client(
// check if fatdb is on // check if fatdb is on
let fat_db = fatdb_switch_to_bool(fat_db, &user_defaults, algorithm)?; let fat_db = fatdb_switch_to_bool(fat_db, &user_defaults, algorithm)?;
if !fat_db && require_fat_db {
return Err("This command requires Parity to be synced with --fat-db on.".to_owned());
}
// prepare client and snapshot paths. // prepare client and snapshot paths.
let client_path = db_dirs.client_path(algorithm); let client_path = db_dirs.client_path(algorithm);
@ -399,7 +403,8 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
cmd.fat_db, cmd.fat_db,
cmd.compaction, cmd.compaction,
cmd.wal, cmd.wal,
cmd.cache_config cmd.cache_config,
false,
)?; )?;
let panic_handler = PanicHandler::new_in_arc(); let panic_handler = PanicHandler::new_in_arc();
let format = cmd.format.unwrap_or_default(); let format = cmd.format.unwrap_or_default();
@ -442,7 +447,8 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> {
cmd.fat_db, cmd.fat_db,
cmd.compaction, cmd.compaction,
cmd.wal, cmd.wal,
cmd.cache_config cmd.cache_config,
true
)?; )?;
let panic_handler = PanicHandler::new_in_arc(); let panic_handler = PanicHandler::new_in_arc();

View File

@ -224,6 +224,8 @@ usage! {
or |c: &Config| otry!(c.mining).force_sealing.clone(), or |c: &Config| otry!(c.mining).force_sealing.clone(),
flag_reseal_on_txs: String = "own", flag_reseal_on_txs: String = "own",
or |c: &Config| otry!(c.mining).reseal_on_txs.clone(), or |c: &Config| otry!(c.mining).reseal_on_txs.clone(),
flag_reseal_on_uncle: bool = false,
or |c: &Config| otry!(c.mining).reseal_on_uncle.clone(),
flag_reseal_min_period: u64 = 2000u64, flag_reseal_min_period: u64 = 2000u64,
or |c: &Config| otry!(c.mining).reseal_min_period.clone(), or |c: &Config| otry!(c.mining).reseal_min_period.clone(),
flag_work_queue_size: usize = 20usize, flag_work_queue_size: usize = 20usize,
@ -461,6 +463,7 @@ struct Mining {
author: Option<String>, author: Option<String>,
engine_signer: Option<String>, engine_signer: Option<String>,
force_sealing: Option<bool>, force_sealing: Option<bool>,
reseal_on_uncle: Option<bool>,
reseal_on_txs: Option<String>, reseal_on_txs: Option<String>,
reseal_min_period: Option<u64>, reseal_min_period: Option<u64>,
work_queue_size: Option<usize>, work_queue_size: Option<usize>,
@ -705,6 +708,7 @@ mod tests {
flag_force_sealing: true, flag_force_sealing: true,
flag_reseal_on_txs: "all".into(), flag_reseal_on_txs: "all".into(),
flag_reseal_min_period: 4000u64, flag_reseal_min_period: 4000u64,
flag_reseal_on_uncle: false,
flag_work_queue_size: 20usize, flag_work_queue_size: 20usize,
flag_tx_gas_limit: Some("6283184".into()), flag_tx_gas_limit: Some("6283184".into()),
flag_tx_time_limit: Some(100u64), flag_tx_time_limit: Some(100u64),
@ -904,6 +908,7 @@ mod tests {
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()), engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
force_sealing: Some(true), force_sealing: Some(true),
reseal_on_txs: Some("all".into()), reseal_on_txs: Some("all".into()),
reseal_on_uncle: None,
reseal_min_period: Some(4000), reseal_min_period: Some(4000),
work_queue_size: None, work_queue_size: None,
relay_set: None, relay_set: None,

View File

@ -221,6 +221,9 @@ Sealing/Mining Options:
ext - reseal only on a new external transaction; ext - reseal only on a new external transaction;
all - reseal on all new transactions all - reseal on all new transactions
(default: {flag_reseal_on_txs}). (default: {flag_reseal_on_txs}).
--reseal-on-uncle Force the node to author new blocks when a new uncle
block is imported.
(default: {flag_reseal_on_uncle})
--reseal-min-period MS Specify the minimum time between reseals from --reseal-min-period MS Specify the minimum time between reseals from
incoming transactions. MS is time measured in incoming transactions. MS is time measured in
milliseconds (default: {flag_reseal_min_period}). milliseconds (default: {flag_reseal_min_period}).

View File

@ -506,6 +506,7 @@ impl Configuration {
force_sealing: self.args.flag_force_sealing, force_sealing: self.args.flag_force_sealing,
reseal_on_external_tx: reseal.external, reseal_on_external_tx: reseal.external,
reseal_on_own_tx: reseal.own, reseal_on_own_tx: reseal.own,
reseal_on_uncle: self.args.flag_reseal_on_uncle,
tx_gas_limit: match self.args.flag_tx_gas_limit { tx_gas_limit: match self.args.flag_tx_gas_limit {
Some(ref d) => to_u256(d)?, Some(ref d) => to_u256(d)?,
None => U256::max_value(), None => U256::max_value(),

View File

@ -159,7 +159,7 @@ impl Informant {
false => String::new(), false => String::new(),
}, },
match (&sync_status, &network_config) { match (&sync_status, &network_config) {
(&Some(ref sync_info), &Some(ref net_config)) => format!("{}{}/{}/{} peers", (&Some(ref sync_info), &Some(ref net_config)) => format!("{}{}/{} peers",
match importing { match importing {
true => format!("{} ", paint(Green.bold(), format!("{:>8}", format!("#{}", sync_info.last_imported_block_number.unwrap_or(chain_info.best_block_number))))), true => format!("{} ", paint(Green.bold(), format!("{:>8}", format!("#{}", sync_info.last_imported_block_number.unwrap_or(chain_info.best_block_number))))),
false => match sync_info.last_imported_old_block_number { false => match sync_info.last_imported_old_block_number {
@ -167,7 +167,6 @@ impl Informant {
None => String::new(), None => String::new(),
} }
}, },
paint(Cyan.bold(), format!("{:2}", sync_info.num_active_peers)),
paint(Cyan.bold(), format!("{:2}", sync_info.num_peers)), paint(Cyan.bold(), format!("{:2}", sync_info.num_peers)),
paint(Cyan.bold(), format!("{:2}", sync_info.current_max_peers(net_config.min_peers, net_config.max_peers))), paint(Cyan.bold(), format!("{:2}", sync_info.current_max_peers(net_config.min_peers, net_config.max_peers))),
), ),

View File

@ -57,6 +57,7 @@ fn miner_service(spec: &Spec, accounts: Arc<AccountProvider>) -> Arc<Miner> {
force_sealing: true, force_sealing: true,
reseal_on_external_tx: true, reseal_on_external_tx: true,
reseal_on_own_tx: true, reseal_on_own_tx: true,
reseal_on_uncle: false,
tx_queue_size: 1024, tx_queue_size: 1024,
tx_gas_limit: !U256::zero(), tx_gas_limit: !U256::zero(),
tx_queue_strategy: PrioritizationStrategy::GasPriceOnly, tx_queue_strategy: PrioritizationStrategy::GasPriceOnly,

View File

@ -3,7 +3,7 @@ description = "Ethcore utility library"
homepage = "http://parity.io" homepage = "http://parity.io"
license = "GPL-3.0" license = "GPL-3.0"
name = "ethcore-util" name = "ethcore-util"
version = "1.6.8" version = "1.6.9"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs" build = "build.rs"