-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ao-abstract-kvdb-with-cache
* master: change dependencies of `keccak-hash`and `trie-standardmap` (#111) bring appveyor back (#118) Extract `should_replace` from Scoring and supply pooled txs from same sender (#116)
- Loading branch information
Showing
15 changed files
with
235 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
[![Build Status travis][travis-image]][travis-url] | ||
[![Build Status appveyor][appveyor-image]][appveyor-url] | ||
|
||
[travis-image]: https://travis-ci.org/paritytech/parity-common.svg?branch=master | ||
[travis-url]: https://travis-ci.org/paritytech/parity-common | ||
[appveyor-image]: https://ci.appveyor.com/api/projects/status/github/paritytech/parity-common/branch/master?svg=true | ||
[appveyor-url]: https://ci.appveyor.com/project/paritytech/parity-common/branch/master | ||
|
||
# parity-common | ||
Collection of crates used in [Parity Technologies](https://www.paritytech.io/) projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
environment: | ||
matrix: | ||
- FEATURES: "" | ||
|
||
platform: | ||
- x86_64-pc-windows-msvc | ||
|
||
# avoid running tests twice | ||
branches: | ||
only: | ||
- master | ||
|
||
install: | ||
- curl -sSf -o rustup-init.exe https://win.rustup.rs/ | ||
- rustup-init.exe -y --default-host %PLATFORM% | ||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin | ||
- rustc -vV | ||
- cargo -vV | ||
|
||
build_script: | ||
- cargo check --tests --features "%FEATURES%" | ||
- cargo build --all --features "%FEATURES%" | ||
|
||
test_script: | ||
- cargo test --all --features "%FEATURES%" --exclude uint --exclude fixed-hash | ||
- cd fixed-hash/ && cargo test --all-features && cd .. | ||
- cd uint/ && cargo test --features=std,quickcheck --release && cd .. | ||
- cd plain_hasher/ && cargo test --no-default-features && cd .. | ||
- cd parity-util-mem/ && cargo test --features=estimate-heapsize && cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[package] | ||
name = "keccak-hash" | ||
version = "0.1.2" | ||
version = "0.1.3" | ||
description = "`keccak-hash` is a set of utility functions to facilitate working with Keccak hashes (256/512 bits long)." | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
repository = "https://github.com/paritytech/parity-common" | ||
readme = "README.md" | ||
license = "GPL-3.0" | ||
|
||
[dependencies] | ||
ethereum-types = "0.4" | ||
tiny-keccak = "1.4" | ||
primitive-types = { path = "../primitive-types", version = "0.2" } | ||
|
||
[dev-dependencies] | ||
tempdir = "0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2015-2019 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! When queue limits are reached, decide whether to replace an existing transaction from the pool | ||
|
||
use pool::Transaction; | ||
use scoring::Choice; | ||
|
||
/// Encapsulates a transaction to be compared, along with pooled transactions from the same sender | ||
pub struct ReplaceTransaction<'a, T> { | ||
/// The transaction to be compared for replacement | ||
pub transaction: &'a Transaction<T>, | ||
/// Other transactions currently in the pool for the same sender | ||
pub pooled_by_sender: Option<&'a [Transaction<T>]>, | ||
} | ||
|
||
impl<'a, T> ReplaceTransaction<'a, T> { | ||
/// Creates a new `ReplaceTransaction` | ||
pub fn new(transaction: &'a Transaction<T>, pooled_by_sender: Option<&'a [Transaction<T>]>) -> Self { | ||
ReplaceTransaction { | ||
transaction, | ||
pooled_by_sender, | ||
} | ||
} | ||
} | ||
|
||
impl<'a, T> ::std::ops::Deref for ReplaceTransaction<'a, T> { | ||
type Target = Transaction<T>; | ||
fn deref(&self) -> &Self::Target { | ||
&self.transaction | ||
} | ||
} | ||
|
||
/// Chooses whether a new transaction should replace an existing transaction if the pool is full. | ||
pub trait ShouldReplace<T> { | ||
/// Decides if `new` should push out `old` transaction from the pool. | ||
/// | ||
/// NOTE returning `InsertNew` here can lead to some transactions being accepted above pool limits. | ||
fn should_replace(&self, old: &ReplaceTransaction<T>, new: &ReplaceTransaction<T>) -> Choice; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.