Only submit signed extrinsics back to pool when retracting block (#3660)

* Only submit signed extrinsics back to pool when retracting block

* Fix import
This commit is contained in:
Wei Tang
2019-09-21 19:50:37 +08:00
committed by Gavin Wood
parent 210290f8ca
commit 642e76b738
+10 -2
View File
@@ -34,7 +34,9 @@ use parking_lot::{Mutex, RwLock};
use primitives::{Blake2Hasher, H256, Hasher};
use rpc::{self, system::SystemInfo};
use sr_primitives::{BuildStorage, generic::BlockId};
use sr_primitives::traits::{Block as BlockT, ProvideRuntimeApi, NumberFor, One, Zero, Header, SaturatedConversion};
use sr_primitives::traits::{
Block as BlockT, Extrinsic, ProvideRuntimeApi, NumberFor, One, Zero, Header, SaturatedConversion
};
use substrate_executor::{NativeExecutor, NativeExecutionDispatch};
use serde::{Serialize, de::DeserializeOwned};
use std::{io::{Read, Write, Seek}, marker::PhantomData, sync::Arc, sync::atomic::AtomicBool};
@@ -929,7 +931,13 @@ pub(crate) fn maintain_transaction_pool<Api, Backend, Block, Executor, PoolApi>(
for r in retracted {
if let Some(block) = client.block(&BlockId::hash(*r))? {
let extrinsics = block.block.extrinsics();
if let Err(e) = transaction_pool.submit_at(id, extrinsics.iter().cloned(), true) {
if let Err(e) = transaction_pool.submit_at(
id,
extrinsics.iter().filter(|e| {
e.is_signed().unwrap_or(false)
}).cloned(),
true
) {
warn!("Error re-submitting transactions: {:?}", e);
}
}