mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
declone and close the door (#12035)
* declone and close the door * cargo fmt * remove brackets
This commit is contained in:
@@ -66,7 +66,7 @@ impl ChainApi for TestApi {
|
||||
uxt: <Self::Block as BlockT>::Extrinsic,
|
||||
) -> Self::ValidationFuture {
|
||||
let nonce = uxt.transfer().nonce;
|
||||
let from = uxt.transfer().from.clone();
|
||||
let from = uxt.transfer().from;
|
||||
|
||||
match self.block_id_to_number(at) {
|
||||
Ok(Some(num)) if num > 5 => return ready(Ok(Err(InvalidTransaction::Stale.into()))),
|
||||
@@ -76,7 +76,7 @@ impl ChainApi for TestApi {
|
||||
ready(Ok(Ok(ValidTransaction {
|
||||
priority: 4,
|
||||
requires: if nonce > 1 && self.nonce_dependant {
|
||||
vec![to_tag(nonce - 1, from.clone())]
|
||||
vec![to_tag(nonce - 1, from)]
|
||||
} else {
|
||||
vec![]
|
||||
},
|
||||
|
||||
@@ -641,7 +641,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// when
|
||||
block_on(pool.prune_tags(&BlockId::Number(1), vec![vec![0]], vec![hash1.clone()])).unwrap();
|
||||
block_on(pool.prune_tags(&BlockId::Number(1), vec![vec![0]], vec![hash1])).unwrap();
|
||||
|
||||
// then
|
||||
assert!(pool.validated_pool.is_banned(&hash1));
|
||||
@@ -793,12 +793,8 @@ mod tests {
|
||||
assert_eq!(pool.validated_pool().status().future, 0);
|
||||
|
||||
// when
|
||||
block_on(pool.prune_tags(
|
||||
&BlockId::Number(2),
|
||||
vec![vec![0u8]],
|
||||
vec![watcher.hash().clone()],
|
||||
))
|
||||
.unwrap();
|
||||
block_on(pool.prune_tags(&BlockId::Number(2), vec![vec![0u8]], vec![*watcher.hash()]))
|
||||
.unwrap();
|
||||
assert_eq!(pool.validated_pool().status().ready, 0);
|
||||
assert_eq!(pool.validated_pool().status().future, 0);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ mod tests {
|
||||
let tx = Transaction {
|
||||
data: (),
|
||||
bytes: 1,
|
||||
hash: hash.clone(),
|
||||
hash,
|
||||
priority: 5,
|
||||
valid_till: 1,
|
||||
requires: vec![],
|
||||
|
||||
@@ -387,7 +387,7 @@ fn should_push_watchers_during_maintenance() {
|
||||
let header_hash = header.hash();
|
||||
block_on(pool.maintain(block_event(header)));
|
||||
|
||||
let event = ChainEvent::Finalized { hash: header_hash.clone(), tree_route: Arc::from(vec![]) };
|
||||
let event = ChainEvent::Finalized { hash: header_hash, tree_route: Arc::from(vec![]) };
|
||||
block_on(pool.maintain(event));
|
||||
|
||||
// then
|
||||
@@ -398,24 +398,24 @@ fn should_push_watchers_during_maintenance() {
|
||||
futures::executor::block_on_stream(watcher0).collect::<Vec<_>>(),
|
||||
vec![
|
||||
TransactionStatus::Ready,
|
||||
TransactionStatus::InBlock(header_hash.clone()),
|
||||
TransactionStatus::Finalized(header_hash.clone())
|
||||
TransactionStatus::InBlock(header_hash),
|
||||
TransactionStatus::Finalized(header_hash)
|
||||
],
|
||||
);
|
||||
assert_eq!(
|
||||
futures::executor::block_on_stream(watcher1).collect::<Vec<_>>(),
|
||||
vec![
|
||||
TransactionStatus::Ready,
|
||||
TransactionStatus::InBlock(header_hash.clone()),
|
||||
TransactionStatus::Finalized(header_hash.clone())
|
||||
TransactionStatus::InBlock(header_hash),
|
||||
TransactionStatus::Finalized(header_hash)
|
||||
],
|
||||
);
|
||||
assert_eq!(
|
||||
futures::executor::block_on_stream(watcher2).collect::<Vec<_>>(),
|
||||
vec![
|
||||
TransactionStatus::Ready,
|
||||
TransactionStatus::InBlock(header_hash.clone()),
|
||||
TransactionStatus::Finalized(header_hash.clone())
|
||||
TransactionStatus::InBlock(header_hash),
|
||||
TransactionStatus::Finalized(header_hash)
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -573,7 +573,7 @@ fn fork_aware_finalization() {
|
||||
for (canon_watcher, h) in canon_watchers {
|
||||
let mut stream = futures::executor::block_on_stream(canon_watcher);
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(h.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(h)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(h)));
|
||||
assert_eq!(stream.next(), None);
|
||||
}
|
||||
@@ -581,22 +581,22 @@ fn fork_aware_finalization() {
|
||||
{
|
||||
let mut stream = futures::executor::block_on_stream(from_dave_watcher);
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c2.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c2)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(c2)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(e1)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(e1.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(e1)));
|
||||
assert_eq!(stream.next(), None);
|
||||
}
|
||||
|
||||
{
|
||||
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(d2.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(d2)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(d2)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(e1)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(e1.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(e1)));
|
||||
assert_eq!(stream.next(), None);
|
||||
}
|
||||
}
|
||||
@@ -646,9 +646,9 @@ fn prune_and_retract_tx_at_same_time() {
|
||||
{
|
||||
let mut stream = futures::executor::block_on_stream(watcher);
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2.clone())));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2)));
|
||||
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2)));
|
||||
assert_eq!(stream.next(), None);
|
||||
}
|
||||
@@ -781,7 +781,7 @@ fn resubmit_from_retracted_fork() {
|
||||
let e1 = {
|
||||
let _ = block_on(pool.submit_and_watch(&BlockId::number(1), SOURCE, tx4.clone()))
|
||||
.expect("1. Imported");
|
||||
let header = pool.api().push_block_with_parent(d1.clone(), vec![tx4.clone()], true);
|
||||
let header = pool.api().push_block_with_parent(d1, vec![tx4.clone()], true);
|
||||
assert_eq!(pool.status().ready, 2);
|
||||
header.hash()
|
||||
};
|
||||
@@ -790,7 +790,7 @@ fn resubmit_from_retracted_fork() {
|
||||
let f1_header = {
|
||||
let _ = block_on(pool.submit_and_watch(&BlockId::number(1), SOURCE, tx5.clone()))
|
||||
.expect("1. Imported");
|
||||
let header = pool.api().push_block_with_parent(e1.clone(), vec![tx5.clone()], true);
|
||||
let header = pool.api().push_block_with_parent(e1, vec![tx5.clone()], true);
|
||||
// Don't announce the block event to the pool directly, because we will
|
||||
// re-org to this block.
|
||||
assert_eq!(pool.status().ready, 3);
|
||||
|
||||
Reference in New Issue
Block a user