@@ -70,10 +70,10 @@ uint256 GetWitnessesAndAnchors(CWallet& wallet,
70
70
return saplingAnchor;
71
71
}
72
72
73
- BOOST_FIXTURE_TEST_SUITE (sapling_wallet_tests, WalletTestingSetup )
73
+ BOOST_FIXTURE_TEST_SUITE (sapling_wallet_tests, WalletRegTestingSetup )
74
74
75
75
BOOST_AUTO_TEST_CASE(SetSaplingNoteAddrsInCWalletTx) {
76
- auto consensusParams = RegtestActivateSapling ();
76
+ auto consensusParams = Params (). GetConsensus ();
77
77
78
78
CWallet& wallet = *pwalletMain;
79
79
LOCK (wallet.cs_wallet );
@@ -124,9 +124,6 @@ BOOST_AUTO_TEST_CASE(SetSaplingNoteAddrsInCWalletTx) {
124
124
BOOST_CHECK (nullifier == wtx.mapSaplingNoteData [op].nullifier );
125
125
BOOST_CHECK (nd.witnessHeight == wtx.mapSaplingNoteData [op].witnessHeight );
126
126
BOOST_CHECK (witness == wtx.mapSaplingNoteData [op].witnesses .front ());
127
-
128
- // Revert to default
129
- RegtestDeactivateSapling ();
130
127
}
131
128
132
129
// Cannot add note data for an index which does not exist in tx.vShieldedOutput
@@ -142,8 +139,9 @@ BOOST_AUTO_TEST_CASE(SetInvalidSaplingNoteDataInCWalletTx) {
142
139
BOOST_CHECK_THROW (wtx.SetSaplingNoteData (noteData), std::logic_error);
143
140
}
144
141
145
- BOOST_AUTO_TEST_CASE (FindMySaplingNotes) {
146
- auto consensusParams = RegtestActivateSapling ();
142
+ BOOST_AUTO_TEST_CASE (FindMySaplingNotes)
143
+ {
144
+ auto consensusParams = Params ().GetConsensus ();
147
145
148
146
CWallet& wallet = *pwalletMain;
149
147
LOCK (wallet.cs_wallet );
@@ -175,14 +173,12 @@ BOOST_AUTO_TEST_CASE(FindMySaplingNotes) {
175
173
BOOST_CHECK (wallet.HaveSaplingSpendingKey (extfvk));
176
174
noteMap = wallet.GetSaplingScriptPubKeyMan ()->FindMySaplingNotes (*wtx.tx ).first ;
177
175
BOOST_CHECK_EQUAL (2 , noteMap.size ());
178
-
179
- // Revert to default
180
- RegtestDeactivateSapling ();
181
176
}
182
177
183
178
// Generate note A and spend to create note B, from which we spend to create two conflicting transactions
184
- BOOST_AUTO_TEST_CASE (GetConflictedSaplingNotes) {
185
- auto consensusParams = RegtestActivateSapling ();
179
+ BOOST_AUTO_TEST_CASE (GetConflictedSaplingNotes)
180
+ {
181
+ auto consensusParams = Params ().GetConsensus ();
186
182
187
183
CWallet& wallet = *pwalletMain;
188
184
LOCK2 (cs_main, wallet.cs_wallet );
@@ -296,15 +292,13 @@ BOOST_AUTO_TEST_CASE(GetConflictedSaplingNotes) {
296
292
BOOST_CHECK (std::set<uint256>({hash2, hash3}) == c3);
297
293
298
294
// Tear down
299
- chainActive.SetTip (NULL );
295
+ chainActive.SetTip (nullptr );
300
296
mapBlockIndex.erase (blockHash);
301
-
302
- // Revert to default
303
- RegtestDeactivateSapling ();
304
297
}
305
298
306
- BOOST_AUTO_TEST_CASE (SaplingNullifierIsSpent) {
307
- auto consensusParams = RegtestActivateSapling ();
299
+ BOOST_AUTO_TEST_CASE (SaplingNullifierIsSpent)
300
+ {
301
+ auto consensusParams = Params ().GetConsensus ();
308
302
309
303
CWallet& wallet = *pwalletMain;
310
304
LOCK2 (cs_main, wallet.cs_wallet );
@@ -357,15 +351,13 @@ BOOST_AUTO_TEST_CASE(SaplingNullifierIsSpent) {
357
351
BOOST_CHECK (wallet.GetSaplingScriptPubKeyMan ()->IsSaplingSpent (nullifier));
358
352
359
353
// Tear down
360
- chainActive.SetTip (NULL );
354
+ chainActive.SetTip (nullptr );
361
355
mapBlockIndex.erase (blockHash);
362
-
363
- // Revert to default
364
- RegtestDeactivateSapling ();
365
356
}
366
357
367
- BOOST_AUTO_TEST_CASE (NavigateFromSaplingNullifierToNote) {
368
- auto consensusParams = RegtestActivateSapling ();
358
+ BOOST_AUTO_TEST_CASE (NavigateFromSaplingNullifierToNote)
359
+ {
360
+ auto consensusParams = Params ().GetConsensus ();
369
361
370
362
CWallet& wallet = *pwalletMain;
371
363
LOCK2 (cs_main, wallet.cs_wallet );
@@ -454,16 +446,14 @@ BOOST_AUTO_TEST_CASE(NavigateFromSaplingNullifierToNote) {
454
446
}
455
447
456
448
// Tear down
457
- chainActive.SetTip (NULL );
449
+ chainActive.SetTip (nullptr );
458
450
mapBlockIndex.erase (blockHash);
459
-
460
- // Revert to default
461
- RegtestDeactivateSapling ();
462
451
}
463
452
464
453
// Create note A, spend A to create note B, spend and verify note B is from me.
465
- BOOST_AUTO_TEST_CASE (SpentSaplingNoteIsFromMe) {
466
- auto consensusParams = RegtestActivateSapling ();
454
+ BOOST_AUTO_TEST_CASE (SpentSaplingNoteIsFromMe)
455
+ {
456
+ auto consensusParams = Params ().GetConsensus ();
467
457
468
458
CWallet& wallet = *pwalletMain;
469
459
LOCK2 (cs_main, wallet.cs_wallet );
@@ -601,16 +591,14 @@ BOOST_AUTO_TEST_CASE(SpentSaplingNoteIsFromMe) {
601
591
BOOST_CHECK (wallet.GetSaplingScriptPubKeyMan ()->mapSaplingNullifiersToNotes .count (nullifier2));
602
592
603
593
// Tear down
604
- chainActive.SetTip (NULL );
594
+ chainActive.SetTip (nullptr );
605
595
mapBlockIndex.erase (blockHash);
606
596
mapBlockIndex.erase (blockHash2);
607
-
608
- // Revert to default
609
- RegtestDeactivateSapling ();
610
597
}
611
598
612
- BOOST_AUTO_TEST_CASE (CachedWitnessesEmptyChain) {
613
- auto consensusParams = RegtestActivateSapling ();
599
+ BOOST_AUTO_TEST_CASE (CachedWitnessesEmptyChain)
600
+ {
601
+ auto consensusParams = Params ().GetConsensus ();
614
602
615
603
CWallet& wallet = *pwalletMain;
616
604
{
@@ -646,13 +634,11 @@ BOOST_AUTO_TEST_CASE(CachedWitnessesEmptyChain) {
646
634
647
635
// Until zcash#1302 is implemented, this should triggger an assertion
648
636
BOOST_CHECK_THROW (wallet.DecrementNoteWitnesses (&index), std::runtime_error);
649
-
650
- // Revert to default
651
- RegtestDeactivateSapling ();
652
637
}
653
638
654
- BOOST_AUTO_TEST_CASE (CachedWitnessesChainTip) {
655
- auto consensusParams = RegtestActivateSapling ();
639
+ BOOST_AUTO_TEST_CASE (CachedWitnessesChainTip)
640
+ {
641
+ auto consensusParams = Params ().GetConsensus ();
656
642
657
643
libzcash::SaplingExtendedSpendingKey sk = GetTestMasterSaplingSpendingKey ();
658
644
CWallet& wallet = *pwalletMain;
@@ -730,9 +716,9 @@ BOOST_AUTO_TEST_CASE(CachedWitnessesChainTip) {
730
716
}
731
717
}
732
718
733
- BOOST_AUTO_TEST_CASE (CachedWitnessesDecrementFirst) {
734
- auto consensusParams = RegtestActivateSapling ();
735
-
719
+ BOOST_AUTO_TEST_CASE (CachedWitnessesDecrementFirst)
720
+ {
721
+ auto consensusParams = Params (). GetConsensus ();
736
722
libzcash::SaplingExtendedSpendingKey sk = GetTestMasterSaplingSpendingKey ();
737
723
CWallet& wallet = *pwalletMain;
738
724
{
@@ -798,8 +784,9 @@ BOOST_AUTO_TEST_CASE(CachedWitnessesDecrementFirst) {
798
784
}
799
785
}
800
786
801
- BOOST_AUTO_TEST_CASE (CachedWitnessesCleanIndex) {
802
- auto consensusParams = RegtestActivateSapling ();
787
+ BOOST_AUTO_TEST_CASE (CachedWitnessesCleanIndex)
788
+ {
789
+ auto consensusParams = Params ().GetConsensus ();
803
790
804
791
libzcash::SaplingExtendedSpendingKey sk = GetTestMasterSaplingSpendingKey ();
805
792
CWallet& wallet = *pwalletMain;
@@ -874,8 +861,9 @@ BOOST_AUTO_TEST_CASE(CachedWitnessesCleanIndex) {
874
861
}
875
862
}
876
863
877
- BOOST_AUTO_TEST_CASE (ClearNoteWitnessCache) {
878
- auto consensusParams = RegtestActivateSapling ();
864
+ BOOST_AUTO_TEST_CASE (ClearNoteWitnessCache)
865
+ {
866
+ auto consensusParams = Params ().GetConsensus ();
879
867
880
868
libzcash::SaplingExtendedSpendingKey sk = GetTestMasterSaplingSpendingKey ();
881
869
CWallet& wallet = *pwalletMain;
@@ -922,8 +910,9 @@ BOOST_AUTO_TEST_CASE(ClearNoteWitnessCache) {
922
910
BOOST_CHECK_EQUAL (0 , wallet.GetSaplingScriptPubKeyMan ()->nWitnessCacheSize );
923
911
}
924
912
925
- BOOST_AUTO_TEST_CASE (UpdatedSaplingNoteData) {
926
- auto consensusParams = RegtestActivateSapling ();
913
+ BOOST_AUTO_TEST_CASE (UpdatedSaplingNoteData)
914
+ {
915
+ auto consensusParams = Params ().GetConsensus ();
927
916
928
917
CWallet& wallet = *pwalletMain;
929
918
// Need to lock cs_main for now due the lock ordering. future: revamp all of this function to only lock where is needed.
@@ -1028,15 +1017,13 @@ BOOST_AUTO_TEST_CASE(UpdatedSaplingNoteData) {
1028
1017
BOOST_CHECK (wtx.mapSaplingNoteData [sop1].witnesses .front () == testNote.tree .witness ());
1029
1018
1030
1019
// Tear down
1031
- chainActive.SetTip (NULL );
1020
+ chainActive.SetTip (nullptr );
1032
1021
mapBlockIndex.erase (blockHash);
1033
-
1034
- // Revert to default
1035
- RegtestDeactivateSapling ();
1036
1022
}
1037
1023
1038
- BOOST_AUTO_TEST_CASE (MarkAffectedSaplingTransactionsDirty) {
1039
- auto consensusParams = RegtestActivateSapling ();
1024
+ BOOST_AUTO_TEST_CASE (MarkAffectedSaplingTransactionsDirty)
1025
+ {
1026
+ auto consensusParams = Params ().GetConsensus ();
1040
1027
1041
1028
CWallet& wallet = *pwalletMain;
1042
1029
LOCK2 (cs_main, wallet.cs_wallet );
@@ -1140,16 +1127,13 @@ BOOST_AUTO_TEST_CASE(MarkAffectedSaplingTransactionsDirty) {
1140
1127
BOOST_CHECK (!wallet.mapWallet .at (hash).IsAmountCached (CWalletTx::AmountType::DEBIT, ISMINE_SPENDABLE));
1141
1128
1142
1129
// Tear down
1143
- chainActive.SetTip (NULL );
1130
+ chainActive.SetTip (nullptr );
1144
1131
mapBlockIndex.erase (blockHash);
1145
-
1146
- // Revert to default
1147
- RegtestDeactivateSapling ();
1148
1132
}
1149
1133
1150
1134
BOOST_AUTO_TEST_CASE (GetNotes)
1151
1135
{
1152
- auto consensusParams = RegtestActivateSapling ();
1136
+ auto consensusParams = Params (). GetConsensus ();
1153
1137
1154
1138
CWallet& wallet = *pwalletMain;
1155
1139
libzcash::SaplingPaymentAddress pk;
@@ -1238,9 +1222,6 @@ BOOST_AUTO_TEST_CASE(GetNotes)
1238
1222
LOCK (cs_main);
1239
1223
chainActive.SetTip (nullptr );
1240
1224
mapBlockIndex.erase (blockHash);
1241
-
1242
- // Revert to default
1243
- RegtestDeactivateSapling ();
1244
1225
}
1245
1226
1246
1227
// TODO: Back port WriteWitnessCache & SetBestChainIgnoresTxsWithoutShieldedData test cases.
0 commit comments