Private packets verification and queue refactoring (#8715)
* Verify private transaction before propagating * Private transactions queue reworked with tx pool queue direct usage * Styling fixed * Prevent resending private packets to the sender * Process signed private transaction packets via io queue * Test fixed * Build and test fixed after merge * Comments after review fixed * Signed transaction taken from verified * Fix after merge * Pool scoring generalized in order to use externally * Lib refactored according to the review comments * Ready state refactored * Redundant bound and copying removed * Fixed build after the merge * Forgotten case reworked * Review comments fixed * Logging reworked, target added * Fix after merge
This commit is contained in:
@@ -10,6 +10,7 @@ ethcore = { path = ".." }
|
||||
ethcore-io = { path = "../../util/io" }
|
||||
ethcore-private-tx = { path = "../private-tx" }
|
||||
ethcore-sync = { path = "../sync" }
|
||||
ethereum-types = "0.3"
|
||||
kvdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
log = "0.4"
|
||||
stop-guard = { path = "../../util/stop-guard" }
|
||||
|
||||
@@ -19,6 +19,7 @@ extern crate ethcore;
|
||||
extern crate ethcore_io as io;
|
||||
extern crate ethcore_private_tx;
|
||||
extern crate ethcore_sync as sync;
|
||||
extern crate ethereum_types;
|
||||
extern crate kvdb;
|
||||
extern crate stop_guard;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
use ansi_term::Colour;
|
||||
use ethereum_types::H256;
|
||||
use io::{IoContext, TimerToken, IoHandler, IoService, IoError};
|
||||
use stop_guard::StopGuard;
|
||||
|
||||
@@ -54,12 +55,24 @@ impl PrivateTxService {
|
||||
}
|
||||
|
||||
impl PrivateTxHandler for PrivateTxService {
|
||||
fn import_private_transaction(&self, rlp: &[u8]) -> Result<(), String> {
|
||||
self.provider.import_private_transaction(rlp).map_err(|e| e.to_string())
|
||||
fn import_private_transaction(&self, rlp: &[u8]) -> Result<H256, String> {
|
||||
match self.provider.import_private_transaction(rlp) {
|
||||
Ok(import_result) => Ok(import_result),
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Unable to import private transaction packet: {}", err);
|
||||
bail!(err.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<(), String> {
|
||||
self.provider.import_signed_private_transaction(rlp).map_err(|e| e.to_string())
|
||||
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<H256, String> {
|
||||
match self.provider.import_signed_private_transaction(rlp) {
|
||||
Ok(import_result) => Ok(import_result),
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Unable to import signed private transaction packet: {}", err);
|
||||
bail!(err.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user