mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
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:
committed by
Gav Wood
parent
1283545b4b
commit
7c51525ad3
@@ -17,7 +17,6 @@
|
||||
extern crate ed25519;
|
||||
extern crate ethereum_types;
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate substrate_rpc;
|
||||
extern crate substrate_primitives as substrate_primitives;
|
||||
extern crate substrate_runtime_primitives as substrate_runtime_primitives;
|
||||
extern crate polkadot_runtime as runtime;
|
||||
@@ -35,10 +34,8 @@ use std::collections::HashMap;
|
||||
use std::cmp::Ordering;
|
||||
use std::sync::Arc;
|
||||
|
||||
use codec::Slicable;
|
||||
use polkadot_api::PolkadotApi;
|
||||
use primitives::{AccountId, Timestamp};
|
||||
use substrate_primitives::block::Extrinsic;
|
||||
use runtime::{Block, UncheckedExtrinsic, TimestampCall, Call};
|
||||
use substrate_runtime_primitives::traits::Checkable;
|
||||
use transaction_pool::{Pool, Readiness};
|
||||
@@ -380,19 +377,6 @@ impl TransactionPool {
|
||||
}
|
||||
}
|
||||
|
||||
impl substrate_rpc::author::AsyncAuthorApi for TransactionPool {
|
||||
fn submit_extrinsic(&mut self, xt: Extrinsic) -> substrate_rpc::author::error::Result<()> {
|
||||
use substrate_primitives::hexdisplay::HexDisplay;
|
||||
info!("Extrinsic submitted: {}", HexDisplay::from(&xt.0));
|
||||
let xt = xt.using_encoded(|ref mut s| UncheckedExtrinsic::decode(s))
|
||||
.ok_or(substrate_rpc::author::error::ErrorKind::InvalidFormat)?;
|
||||
info!("Correctly formatted: {:?}", xt);
|
||||
self.import(xt)
|
||||
.map(|_| ())
|
||||
.map_err(|_| substrate_rpc::author::error::ErrorKind::PoolError.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user