Skip to content

Commit 751ce6d

Browse files
test: fix populate_test_db conf calculation
populate_test_db won't give back a confirmed transaction if you asked for 0 confirmations.
1 parent 2b5fea5 commit 751ce6d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/database/memory.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,13 @@ macro_rules! populate_test_db {
508508
};
509509

510510
let txid = tx.txid();
511-
let confirmation_time = tx_meta.min_confirmations.map(|conf| $crate::BlockTime {
512-
height: current_height.unwrap().checked_sub(conf as u32).unwrap(),
513-
timestamp: 0,
514-
});
511+
let confirmation_time = tx_meta
512+
.min_confirmations
513+
.and_then(|v| if v == 0 { None } else { Some(v) })
514+
.map(|conf| $crate::BlockTime {
515+
height: current_height.unwrap().checked_sub(conf as u32).unwrap(),
516+
timestamp: 0,
517+
});
515518

516519
let tx_details = $crate::TransactionDetails {
517520
transaction: Some(tx.clone()),

0 commit comments

Comments
 (0)