Hook RPC extrinsic import into propagation (#158)

* call `on_new_transactions` when we import

* fix trace

* pass correct bytes to network

* clean up

* cull before repropagating; repropagate on timer

* add a little tracing
This commit is contained in:
Robert Habermeier
2018-05-15 10:27:18 +02:00
committed by Gav Wood
parent 413ebf3f19
commit f997a3bdf1
8 changed files with 81 additions and 44 deletions
-14
View File
@@ -16,8 +16,6 @@
//! Substrate block-author/full-node API.
use std::sync::Arc;
use parking_lot::Mutex;
use primitives::block::Extrinsic;
pub mod error;
@@ -35,15 +33,3 @@ build_rpc_trait! {
fn submit_extrinsic(&self, Extrinsic) -> Result<()>;
}
}
/// Variant of the AuthorApi that doesn't need to be Sync + Send + 'static.
pub trait AsyncAuthorApi: Send + 'static {
/// Submit extrinsic for inclusion in block.
fn submit_extrinsic(&mut self, Extrinsic) -> Result<()>;
}
impl<T: AsyncAuthorApi> AuthorApi for Arc<Mutex<T>> {
fn submit_extrinsic(&self, xt: Extrinsic) -> Result<()> {
self.as_ref().lock().submit_extrinsic(xt)
}
}