diff --git a/tx-pool/src/component/orphan.rs b/tx-pool/src/component/orphan.rs index c9aaab7a39c..2a11630ce86 100644 --- a/tx-pool/src/component/orphan.rs +++ b/tx-pool/src/component/orphan.rs @@ -154,10 +154,10 @@ impl OrphanPool { self.limit_size() } - pub fn find_by_previous(&self, tx: &TransactionView) -> Vec { + pub fn find_by_previous(&self, tx: &TransactionView) -> Vec<&ProposalShortId> { tx.output_pts() .iter() - .filter_map(|out_point| self.by_out_point.get(out_point).cloned()) + .filter_map(|out_point| self.by_out_point.get(out_point)) .flatten() .collect::>() } diff --git a/tx-pool/src/component/tests/orphan.rs b/tx-pool/src/component/tests/orphan.rs index 9336ab8b54d..bfd5e00cdac 100644 --- a/tx-pool/src/component/tests/orphan.rs +++ b/tx-pool/src/component/tests/orphan.rs @@ -46,13 +46,13 @@ fn test_orphan_duplicated() { let txs = orphan.find_by_previous(&tx1); assert_eq!(txs.len(), 3); - assert!(txs.contains(&tx2.proposal_short_id())); - assert!(txs.contains(&tx4.proposal_short_id())); - assert!(txs.contains(&tx5.proposal_short_id())); + assert!(txs.contains(&&tx2.proposal_short_id())); + assert!(txs.contains(&&tx4.proposal_short_id())); + assert!(txs.contains(&&tx5.proposal_short_id())); orphan.remove_orphan_tx(&tx4.proposal_short_id()); let txs = orphan.find_by_previous(&tx1); assert_eq!(txs.len(), 2); - assert!(txs.contains(&tx2.proposal_short_id())); - assert!(txs.contains(&tx5.proposal_short_id())); + assert!(txs.contains(&&tx2.proposal_short_id())); + assert!(txs.contains(&&tx5.proposal_short_id())); }