Fix double spend test.
@@ -168,11 +168,13 @@ impl UnconfirmedPool {
fn find_duplicate_input(array_of_tx: &[Arc<Transaction>], tx: &Arc<Transaction>) -> bool {
for transaction in array_of_tx {
for input in transaction.body.inputs() {
- if tx.body.inputs().contains(input) {
+ for tx_input in tx.body.inputs() {
+ if tx_input.commitment == input.commitment {
return true;
}
}
}
+ }
false
}
@@ -193,7 +195,8 @@ impl UnconfirmedPool {
let mut removed_tx_keys = Vec::new();
for (tx_key, ptx) in self.txs_by_signature.iter() {
for input in ptx.transaction.body.inputs() {
- if published_block.body.inputs().contains(input) {
+ for published_input in published_block.body.inputs() {
+ if published_input.commitment == input.commitment {
self.txs_by_priority.remove(&ptx.priority);
debug!(
target: LOG_TARGET,
@@ -205,6 +208,7 @@ impl UnconfirmedPool {
}
}
}
+ }
for tx_key in &removed_tx_keys {
self.txs_by_signature.remove(&tx_key);
