Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sync in revert_genesis to show unhandled reorg #28

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,7 @@ fn reorg_history(#[case] history_type: HistoryType, #[case] reorg_type: ReorgTyp
#[rstest]
#[ignore = "fix needed"]
#[case(false)]
#[ignore = "fix needed"]
#[case(true)]
#[serial]
fn revert_genesis(#[case] with_transfers: bool) {
Expand Down Expand Up @@ -1829,6 +1830,11 @@ fn revert_genesis(#[case] with_transfers: bool) {
wlt.switch_to_instance(INSTANCE_3);
assert_eq!(wlt.get_witness_ord(&utxo.txid), WitnessOrd::Archived);

// this should remove the utxo that is now archived but it doesn't
wlt.sync();
let utxos = wlt.utxos();
assert!(utxos.is_empty());

wlt.check_allocations(
contract_id,
&iface_type_name,
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,10 @@ impl TestWallet {
self.wallet.stock().contracts().unwrap().collect()
}

pub fn utxos(&self) -> Vec<WalletUtxo> {
self.wallet.wallet().utxos().collect()
}

pub fn debug_contracts(&self) {
println!("Contracts:");
for info in self.list_contracts() {
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub use bpstd::{
};
pub use bpwallet::{
fs::FsTextStore, indexers::esplora::Client as EsploraClient, AnyIndexer, Indexer as BpIndexer,
Wallet,
Wallet, WalletUtxo,
};
pub use descriptors::Wpkh;
pub use electrum::{Client as ElectrumClient, ElectrumApi, Param};
Expand Down
Loading