From cbad2a9fae22e5531e3b4ff1b0a9d6a223826c71 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Thu, 6 Aug 2020 12:44:39 -0600 Subject: [PATCH] Add failing test: fresh transaction-status column shouldn't point at valid root 0 --- ledger/src/blockstore.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index a66133a86b..be500c6222 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -6072,6 +6072,23 @@ pub mod tests { ); } + #[test] + fn test_empty_transaction_status_contains_no_roots() { + let blockstore_path = get_tmp_ledger_path!(); + let blockstore = Blockstore::open(&blockstore_path).unwrap(); + blockstore.set_roots(&[0]).unwrap(); + let index_iterator = blockstore + .transaction_status_cf + .iter(IteratorMode::From( + cf::TransactionStatus::as_index(0), + IteratorDirection::Forward, + )) + .unwrap(); + for ((_, _, slot), _) in index_iterator { + assert!(!blockstore.is_root(slot)); + } + } + #[test] fn test_get_confirmed_signatures_for_address() { let blockstore_path = get_tmp_ledger_path!();