@@ -970,12 +970,13 @@ fn test_tx_conflict_handling() {
970970 for scenario in scenarios {
971971 let env = init_graph ( scenario. tx_templates . iter ( ) ) ;
972972
973- let txs = local_chain
974- . canonical_view (
975- & env. tx_graph ,
976- chain_tip,
977- env. canonicalization_params . clone ( ) ,
978- )
973+ let canonical_view = local_chain. canonical_view (
974+ & env. tx_graph ,
975+ chain_tip,
976+ env. canonicalization_params . clone ( ) ,
977+ ) ;
978+
979+ let txs = canonical_view
979980 . txs ( )
980981 . map ( |tx| tx. txid )
981982 . collect :: < BTreeSet < _ > > ( ) ;
@@ -990,12 +991,7 @@ fn test_tx_conflict_handling() {
990991 scenario. name
991992 ) ;
992993
993- let txouts = local_chain
994- . canonical_view (
995- & env. tx_graph ,
996- chain_tip,
997- env. canonicalization_params . clone ( ) ,
998- )
994+ let txouts = canonical_view
999995 . filter_outpoints ( env. indexer . outpoints ( ) . iter ( ) . cloned ( ) )
1000996 . map ( |( _, full_txout) | full_txout. outpoint )
1001997 . collect :: < BTreeSet < _ > > ( ) ;
@@ -1013,12 +1009,7 @@ fn test_tx_conflict_handling() {
10131009 scenario. name
10141010 ) ;
10151011
1016- let utxos = local_chain
1017- . canonical_view (
1018- & env. tx_graph ,
1019- chain_tip,
1020- env. canonicalization_params . clone ( ) ,
1021- )
1012+ let utxos = canonical_view
10221013 . filter_unspent_outpoints ( env. indexer . outpoints ( ) . iter ( ) . cloned ( ) )
10231014 . map ( |( _, full_txout) | full_txout. outpoint )
10241015 . collect :: < BTreeSet < _ > > ( ) ;
@@ -1036,21 +1027,15 @@ fn test_tx_conflict_handling() {
10361027 scenario. name
10371028 ) ;
10381029
1039- let balance = local_chain
1040- . canonical_view (
1041- & env. tx_graph ,
1042- chain_tip,
1043- env. canonicalization_params . clone ( ) ,
1044- )
1045- . balance (
1046- env. indexer . outpoints ( ) . iter ( ) . cloned ( ) ,
1047- |_, txout| {
1048- env. indexer
1049- . index_of_spk ( txout. txout . script_pubkey . as_script ( ) )
1050- . is_some ( )
1051- } ,
1052- 0 ,
1053- ) ;
1030+ let balance = canonical_view. balance (
1031+ env. indexer . outpoints ( ) . iter ( ) . cloned ( ) ,
1032+ |_, txout| {
1033+ env. indexer
1034+ . index_of_spk ( txout. txout . script_pubkey . as_script ( ) )
1035+ . is_some ( )
1036+ } ,
1037+ 0 ,
1038+ ) ;
10541039 assert_eq ! (
10551040 balance, scenario. exp_balance,
10561041 "\n [{}] 'balance' failed" ,
0 commit comments