Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into refactor/hashdb-generic
Browse files Browse the repository at this point in the history
* master:
  Check whether we need resealing in miner and unwrap has_account in account_provider (#8853)
  docker: Fix alpine build (#8878)
  Remove mac os installers etc (#8875)
  README.md: update the list of dependencies (#8864)
  Fix concurrent access to signer queue (#8854)
  • Loading branch information
dvdplm committed Jun 13, 2018
2 parents 4d733bc + 3094ae9 commit fe91723
Show file tree
Hide file tree
Showing 31 changed files with 102 additions and 2,406 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ We recommend installing Rust through [rustup](https://www.rustup.rs/). If you do
$ curl https://sh.rustup.rs -sSf | sh
```

Parity also requires `gcc`, `g++`, `libssl-dev`/`openssl`, `libudev-dev` and `pkg-config` packages to be installed.
Parity also requires `gcc`, `g++`, `libssl-dev`/`openssl`, `libudev-dev`, `pkg-config`, `file` and `make` packages to be installed.

- OSX:
```bash
Expand Down
8 changes: 4 additions & 4 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.7
FROM alpine:edge

WORKDIR /build

# install tools and dependencies
RUN apk add --no-cache gcc musl-dev openssl-dev pkgconfig g++ make curl \
eudev-dev rust cargo git file binutils libusb-dev \
linux-headers
RUN apk add --no-cache gcc musl-dev pkgconfig g++ make curl \
eudev-dev rust cargo git file binutils \
libusb-dev linux-headers perl

# show backtraces
ENV RUST_BACKTRACE 1
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/account_provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ impl AccountProvider {
}

/// Checks whether an account with a given address is present.
pub fn has_account(&self, address: Address) -> Result<bool, Error> {
Ok(self.sstore.account_ref(&address).is_ok() && !self.blacklisted_accounts.contains(&address))
pub fn has_account(&self, address: Address) -> bool {
self.sstore.account_ref(&address).is_ok() && !self.blacklisted_accounts.contains(&address)
}

/// Returns addresses of all accounts.
Expand Down
33 changes: 20 additions & 13 deletions ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,20 @@ impl Miner {
// Return if we restarted
prepare_new
}

/// Prepare pending block, check whether sealing is needed, and then update sealing.
fn prepare_and_update_sealing<C: miner::BlockChainClient>(&self, chain: &C) {
use miner::MinerService;

// Make sure to do it after transaction is imported and lock is dropped.
// We need to create pending block and enable sealing.
if self.engine.seals_internally().unwrap_or(false) || !self.prepare_pending_block(chain) {
// If new block has not been prepared (means we already had one)
// or Engine might be able to seal internally,
// we need to update sealing.
self.update_sealing(chain);
}
}
}

const SEALING_TIMEOUT_IN_BLOCKS : u64 = 5;
Expand Down Expand Up @@ -766,12 +780,12 @@ impl miner::MinerService for Miner {
transactions.into_iter().map(pool::verifier::Transaction::Unverified).collect(),
);

// --------------------------------------------------------------------------
// | NOTE Code below requires sealing locks. |
// | Make sure to release the locks before calling that method. |
// --------------------------------------------------------------------------
if !results.is_empty() && self.options.reseal_on_external_tx && self.sealing.lock().reseal_allowed() {
// --------------------------------------------------------------------------
// | NOTE Code below requires sealing locks. |
// | Make sure to release the locks before calling that method. |
// --------------------------------------------------------------------------
self.update_sealing(chain);
self.prepare_and_update_sealing(chain);
}

results
Expand All @@ -796,14 +810,7 @@ impl miner::MinerService for Miner {
// | Make sure to release the locks before calling that method. |
// --------------------------------------------------------------------------
if imported.is_ok() && self.options.reseal_on_own_tx && self.sealing.lock().reseal_allowed() {
// Make sure to do it after transaction is imported and lock is droped.
// We need to create pending block and enable sealing.
if self.engine.seals_internally().unwrap_or(false) || !self.prepare_pending_block(chain) {
// If new block has not been prepared (means we already had one)
// or Engine might be able to seal internally,
// we need to update sealing.
self.update_sealing(chain);
}
self.prepare_and_update_sealing(chain);
}

imported
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/miner/pool_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<'a, C: 'a> pool::client::Client for PoolClient<'a, C> where
pool::client::AccountDetails {
nonce: self.cached_nonces.account_nonce(address),
balance: self.chain.latest_balance(address),
is_local: self.accounts.map_or(false, |accounts| accounts.has_account(*address).unwrap_or(false)),
is_local: self.accounts.map_or(false, |accounts| accounts.has_account(*address)),
}
}

Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/snapshot/tests/proof_of_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fn fixed_to_contract_only() {
secret!("dog42"),
]);

assert!(provider.has_account(*RICH_ADDR).unwrap());
assert!(provider.has_account(*RICH_ADDR));

let client = make_chain(provider, 3, vec![
Transition::Manual(3, vec![addrs[2], addrs[3], addrs[5], addrs[7]]),
Expand Down Expand Up @@ -247,7 +247,7 @@ fn fixed_to_contract_to_contract() {
secret!("dog42"),
]);

assert!(provider.has_account(*RICH_ADDR).unwrap());
assert!(provider.has_account(*RICH_ADDR));

let client = make_chain(provider, 3, vec![
Transition::Manual(3, vec![addrs[2], addrs[3], addrs[5], addrs[7]]),
Expand Down
Loading

0 comments on commit fe91723

Please sign in to comment.