Skip to content

Commit 83e62a0

Browse files
committed
code refactor
1 parent 211271b commit 83e62a0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tx-pool/src/component/orphan.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ impl OrphanPool {
154154
self.limit_size()
155155
}
156156

157-
pub fn find_by_previous(&self, tx: &TransactionView) -> Vec<ProposalShortId> {
157+
pub fn find_by_previous(&self, tx: &TransactionView) -> Vec<&ProposalShortId> {
158158
tx.output_pts()
159159
.iter()
160-
.filter_map(|out_point| self.by_out_point.get(out_point).cloned())
160+
.filter_map(|out_point| self.by_out_point.get(out_point))
161161
.flatten()
162162
.collect::<Vec<_>>()
163163
}

tx-pool/src/component/tests/orphan.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ fn test_orphan_duplicated() {
4646

4747
let txs = orphan.find_by_previous(&tx1);
4848
assert_eq!(txs.len(), 3);
49-
assert!(txs.contains(&tx2.proposal_short_id()));
50-
assert!(txs.contains(&tx4.proposal_short_id()));
51-
assert!(txs.contains(&tx5.proposal_short_id()));
49+
assert!(txs.contains(&&tx2.proposal_short_id()));
50+
assert!(txs.contains(&&tx4.proposal_short_id()));
51+
assert!(txs.contains(&&tx5.proposal_short_id()));
5252

5353
orphan.remove_orphan_tx(&tx4.proposal_short_id());
5454
let txs = orphan.find_by_previous(&tx1);
5555
assert_eq!(txs.len(), 2);
56-
assert!(txs.contains(&tx2.proposal_short_id()));
57-
assert!(txs.contains(&tx5.proposal_short_id()));
56+
assert!(txs.contains(&&tx2.proposal_short_id()));
57+
assert!(txs.contains(&&tx5.proposal_short_id()));
5858
}

0 commit comments

Comments
 (0)