> for Author whe
Ok(self.pool.ready().map(|tx| tx.data.encode().into()).collect())
}
+ fn remove_extrinsic(&self, bytes_or_hash: Vec >>, xt: Bytes) {
let submit = || -> Result<_> {
let best_block_hash = self.client.info()?.chain.best_hash;
diff --git a/substrate/core/rpc/src/author/tests.rs b/substrate/core/rpc/src/author/tests.rs
index 4d0277f7d6..4c6a724acd 100644
--- a/substrate/core/rpc/src/author/tests.rs
+++ b/substrate/core/rpc/src/author/tests.rs
@@ -137,3 +137,31 @@ fn should_return_pending_extrinsics() {
Ok(ref expected) if *expected == vec![Bytes(ex.encode())]
);
}
+
+#[test]
+fn should_remove_extrinsics() {
+ let runtime = runtime::Runtime::new().unwrap();
+ let client = Arc::new(test_client::new());
+ let pool = Arc::new(Pool::new(Default::default(), ChainApi::new(client.clone())));
+ let p = Author {
+ client,
+ pool: pool.clone(),
+ subscriptions: Subscriptions::new(runtime.executor()),
+ };
+ let ex1 = uxt(AccountKeyring::Alice, 0);
+ p.submit_extrinsic(ex1.encode().into()).unwrap();
+ let ex2 = uxt(AccountKeyring::Alice, 1);
+ p.submit_extrinsic(ex2.encode().into()).unwrap();
+ let ex3 = uxt(AccountKeyring::Bob, 0);
+ let hash3 = p.submit_extrinsic(ex3.encode().into()).unwrap();
+ assert_eq!(pool.status().ready, 3);
+
+ // now remove all 3
+ let removed = p.remove_extrinsic(vec![
+ hash::ExtrinsicOrHash::Hash(hash3),
+ // Removing this one will also remove ex2
+ hash::ExtrinsicOrHash::Extrinsic(ex1.encode().into()),
+ ]).unwrap();
+
+ assert_eq!(removed.len(), 3);
+}
diff --git a/substrate/core/transaction-pool/graph/src/pool.rs b/substrate/core/transaction-pool/graph/src/pool.rs
index 61e234f156..4498598aee 100644
--- a/substrate/core/transaction-pool/graph/src/pool.rs
+++ b/substrate/core/transaction-pool/graph/src/pool.rs
@@ -417,8 +417,7 @@ impl