Revert "Watch existing extrinsics RPC (#3873)" (#3931)

This reverts commit d149c2f719.
This commit is contained in:
Gavin Wood
2019-10-27 13:19:06 +01:00
committed by GitHub
parent d149c2f719
commit d41a5ce00f
15 changed files with 73 additions and 194 deletions
@@ -165,17 +165,6 @@ impl<B: ChainApi> Pool<B> {
)
}
/// Watch existing transaction
///
/// Get notified when some existing transaction is finished verifying or gets finalized
/// in a new block.
pub fn watch(
&self,
hash: ExHash<B>,
) -> Watcher<ExHash<B>, BlockHash<B>> {
self.validated_pool.watch(hash)
}
/// Prunes ready transactions.
///
/// Used to clear the pool from transactions that were part of recently imported block.
@@ -794,6 +783,7 @@ mod tests {
// when
pool.validated_pool.remove_invalid(&[*watcher.hash()]);
// then
let mut stream = futures::executor::block_on_stream(watcher.into_stream());
assert_eq!(stream.next(), Some(watcher::Status::Ready));
@@ -917,37 +907,5 @@ mod tests {
assert_eq!(pool.status().ready, 1);
assert_eq!(pool.status().future, 0);
}
#[test]
fn should_watch_existing() {
let limit = Limit {
count: 1,
total_bytes: 1000,
};
let pool = Pool::new(Options {
ready: limit.clone(),
future: limit.clone(),
}, TestApi::default());
let xt = uxt(Transfer {
from: AccountId::from_h256(H256::from_low_u64_be(1)),
to: AccountId::from_h256(H256::from_low_u64_be(2)),
amount: 5,
nonce: 0,
});
let hash = block_on(pool.submit_one(&BlockId::Number(0), xt)).expect("Failed to submit");
assert_eq!(pool.status().ready, 1);
let watcher = pool.watch(hash);
block_on(pool.prune_tags(&BlockId::Number(2), vec![], vec![hash]))
.expect("Failed to prune tags");
let mut stream = futures::executor::block_on_stream(
watcher.into_stream()
);
assert_eq!(stream.next(), Some(watcher::Status::Finalized(H256::from_low_u64_be(2).into())));
assert_eq!(stream.next(), None);
}
}
}