|
|
@ -120,8 +120,8 @@ std::pair<JSOutPoint, SaplingOutPoint> CreateValidBlock(TestWallet& wallet, |
|
|
|
std::pair<uint256, uint256> GetWitnessesAndAnchors(TestWallet& wallet, |
|
|
|
std::vector<JSOutPoint>& sproutNotes, |
|
|
|
std::vector<SaplingOutPoint>& saplingNotes, |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>>& sproutWitnesses, |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>>& saplingWitnesses) { |
|
|
|
std::vector<boost::optional<SproutWitness>>& sproutWitnesses, |
|
|
|
std::vector<boost::optional<SaplingWitness>>& saplingWitnesses) { |
|
|
|
sproutWitnesses.clear(); |
|
|
|
saplingWitnesses.clear(); |
|
|
|
uint256 sproutAnchor; |
|
|
@ -585,8 +585,8 @@ TEST(wallet_tests, cached_witnesses_empty_chain) { |
|
|
|
std::vector<JSOutPoint> sproutNotes {jsoutpt, jsoutpt2}; |
|
|
|
std::vector<SaplingOutPoint> saplingNotes = SetSaplingNoteData(wtx); |
|
|
|
|
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
|
|
|
|
::GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses, saplingWitnesses); |
|
|
|
|
|
|
@ -639,8 +639,8 @@ TEST(wallet_tests, cached_witnesses_chain_tip) { |
|
|
|
// Called to fetch anchor
|
|
|
|
std::vector<JSOutPoint> sproutNotes {outpts.first}; |
|
|
|
std::vector<SaplingOutPoint> saplingNotes {outpts.second}; |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
|
|
|
|
anchors1 = GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses, saplingWitnesses); |
|
|
|
EXPECT_NE(anchors1.first, anchors1.second); |
|
|
@ -661,8 +661,8 @@ TEST(wallet_tests, cached_witnesses_chain_tip) { |
|
|
|
wallet.AddToWallet(wtx, true, NULL); |
|
|
|
|
|
|
|
std::vector<JSOutPoint> sproutNotes {jsoutpt}; |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
|
|
|
|
GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses, saplingWitnesses); |
|
|
|
|
|
|
@ -709,8 +709,8 @@ TEST(wallet_tests, cached_witnesses_chain_tip) { |
|
|
|
|
|
|
|
// Incrementing with the same block again should not change the cache
|
|
|
|
wallet.IncrementNoteWitnesses(&index2, &block2, sproutTree, saplingTree); |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses5; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses5; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses5; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses5; |
|
|
|
|
|
|
|
auto anchors5 = GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses5, saplingWitnesses5); |
|
|
|
EXPECT_NE(anchors5.first, anchors5.second); |
|
|
@ -750,8 +750,8 @@ TEST(wallet_tests, CachedWitnessesDecrementFirst) { |
|
|
|
// Called to fetch anchor
|
|
|
|
std::vector<JSOutPoint> sproutNotes {outpts.first}; |
|
|
|
std::vector<SaplingOutPoint> saplingNotes {outpts.second}; |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
anchors2 = GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses, saplingWitnesses); |
|
|
|
} |
|
|
|
|
|
|
@ -770,8 +770,8 @@ TEST(wallet_tests, CachedWitnessesDecrementFirst) { |
|
|
|
wallet.AddToWallet(wtx, true, NULL); |
|
|
|
|
|
|
|
std::vector<JSOutPoint> sproutNotes {jsoutpt}; |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
|
|
|
|
auto anchors3 = GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses, saplingWitnesses); |
|
|
|
|
|
|
@ -814,8 +814,8 @@ TEST(wallet_tests, CachedWitnessesCleanIndex) { |
|
|
|
SproutMerkleTree sproutRiTree = sproutTree; |
|
|
|
SaplingMerkleTree saplingTree; |
|
|
|
SaplingMerkleTree saplingRiTree = saplingTree; |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
|
|
|
|
auto sk = libzcash::SproutSpendingKey::random(); |
|
|
|
wallet.AddSpendingKey(sk); |
|
|
@ -922,8 +922,8 @@ TEST(wallet_tests, ClearNoteWitnessCache) { |
|
|
|
wallet.AddToWallet(wtx, true, NULL); |
|
|
|
|
|
|
|
std::vector<JSOutPoint> sproutNotes {jsoutpt, jsoutpt2}; |
|
|
|
std::vector<boost::optional<ZCIncrementalWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<ZCSaplingIncrementalWitness>> saplingWitnesses; |
|
|
|
std::vector<boost::optional<SproutWitness>> sproutWitnesses; |
|
|
|
std::vector<boost::optional<SaplingWitness>> saplingWitnesses; |
|
|
|
|
|
|
|
// Before clearing, we should have a witness for one note
|
|
|
|
GetWitnessesAndAnchors(wallet, sproutNotes, saplingNotes, sproutWitnesses, saplingWitnesses); |
|
|
|