Rename methods to include Sprout
This commit is contained in:
parent
beb465dd2e
commit
8f41036701
|
@ -91,14 +91,14 @@ TEST(Validation, ReceivedBlockTransactions) {
|
||||||
|
|
||||||
// Create a fake genesis block
|
// Create a fake genesis block
|
||||||
CBlock block1;
|
CBlock block1;
|
||||||
block1.vtx.push_back(GetValidReceive(*params, sk, 5, true));
|
block1.vtx.push_back(GetValidSproutReceive(*params, sk, 5, true));
|
||||||
block1.hashMerkleRoot = block1.BuildMerkleTree();
|
block1.hashMerkleRoot = block1.BuildMerkleTree();
|
||||||
CBlockIndex fakeIndex1 {block1};
|
CBlockIndex fakeIndex1 {block1};
|
||||||
|
|
||||||
// Create a fake child block
|
// Create a fake child block
|
||||||
CBlock block2;
|
CBlock block2;
|
||||||
block2.hashPrevBlock = block1.GetHash();
|
block2.hashPrevBlock = block1.GetHash();
|
||||||
block2.vtx.push_back(GetValidReceive(*params, sk, 10, true));
|
block2.vtx.push_back(GetValidSproutReceive(*params, sk, 10, true));
|
||||||
block2.hashMerkleRoot = block2.BuildMerkleTree();
|
block2.hashMerkleRoot = block2.BuildMerkleTree();
|
||||||
CBlockIndex fakeIndex2 {block2};
|
CBlockIndex fakeIndex2 {block2};
|
||||||
fakeIndex2.pprev = &fakeIndex1;
|
fakeIndex2.pprev = &fakeIndex1;
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
CWalletTx GetValidReceive(ZCJoinSplit& params,
|
CWalletTx GetValidSproutReceive(ZCJoinSplit& params,
|
||||||
const libzcash::SproutSpendingKey& sk, CAmount value,
|
const libzcash::SproutSpendingKey& sk,
|
||||||
bool randomInputs,
|
CAmount value,
|
||||||
int32_t version /* = 2 */) {
|
bool randomInputs,
|
||||||
|
int32_t version /* = 2 */) {
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.nVersion = version;
|
mtx.nVersion = version;
|
||||||
mtx.vin.resize(2);
|
mtx.vin.resize(2);
|
||||||
|
@ -70,9 +71,9 @@ CWalletTx GetValidReceive(ZCJoinSplit& params,
|
||||||
return wtx;
|
return wtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
libzcash::SproutNote GetNote(ZCJoinSplit& params,
|
libzcash::SproutNote GetSproutNote(ZCJoinSplit& params,
|
||||||
const libzcash::SproutSpendingKey& sk,
|
const libzcash::SproutSpendingKey& sk,
|
||||||
const CTransaction& tx, size_t js, size_t n) {
|
const CTransaction& tx, size_t js, size_t n) {
|
||||||
ZCNoteDecryption decryptor {sk.receiving_key()};
|
ZCNoteDecryption decryptor {sk.receiving_key()};
|
||||||
auto hSig = tx.vjoinsplit[js].h_sig(params, tx.joinSplitPubKey);
|
auto hSig = tx.vjoinsplit[js].h_sig(params, tx.joinSplitPubKey);
|
||||||
auto note_pt = libzcash::SproutNotePlaintext::decrypt(
|
auto note_pt = libzcash::SproutNotePlaintext::decrypt(
|
||||||
|
@ -84,9 +85,10 @@ libzcash::SproutNote GetNote(ZCJoinSplit& params,
|
||||||
return note_pt.note(sk.address());
|
return note_pt.note(sk.address());
|
||||||
}
|
}
|
||||||
|
|
||||||
CWalletTx GetValidSpend(ZCJoinSplit& params,
|
CWalletTx GetValidSproutSpend(ZCJoinSplit& params,
|
||||||
const libzcash::SproutSpendingKey& sk,
|
const libzcash::SproutSpendingKey& sk,
|
||||||
const libzcash::SproutNote& note, CAmount value) {
|
const libzcash::SproutNote& note,
|
||||||
|
CAmount value) {
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.vout.resize(2);
|
mtx.vout.resize(2);
|
||||||
mtx.vout[0].nValue = value;
|
mtx.vout[0].nValue = value;
|
||||||
|
|
|
@ -7,13 +7,15 @@
|
||||||
#include "zcash/Note.hpp"
|
#include "zcash/Note.hpp"
|
||||||
#include "zcash/NoteEncryption.hpp"
|
#include "zcash/NoteEncryption.hpp"
|
||||||
|
|
||||||
CWalletTx GetValidReceive(ZCJoinSplit& params,
|
CWalletTx GetValidSproutReceive(ZCJoinSplit& params,
|
||||||
const libzcash::SproutSpendingKey& sk, CAmount value,
|
const libzcash::SproutSpendingKey& sk,
|
||||||
bool randomInputs,
|
CAmount value,
|
||||||
int32_t version = 2);
|
bool randomInputs,
|
||||||
libzcash::SproutNote GetNote(ZCJoinSplit& params,
|
int32_t version = 2);
|
||||||
const libzcash::SproutSpendingKey& sk,
|
libzcash::SproutNote GetSproutNote(ZCJoinSplit& params,
|
||||||
const CTransaction& tx, size_t js, size_t n);
|
const libzcash::SproutSpendingKey& sk,
|
||||||
CWalletTx GetValidSpend(ZCJoinSplit& params,
|
const CTransaction& tx, size_t js, size_t n);
|
||||||
const libzcash::SproutSpendingKey& sk,
|
CWalletTx GetValidSproutSpend(ZCJoinSplit& params,
|
||||||
const libzcash::SproutNote& note, CAmount value);
|
const libzcash::SproutSpendingKey& sk,
|
||||||
|
const libzcash::SproutNote& note,
|
||||||
|
CAmount value);
|
||||||
|
|
|
@ -73,18 +73,18 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CWalletTx GetValidReceive(const libzcash::SproutSpendingKey& sk, CAmount value, bool randomInputs, int32_t version = 2) {
|
CWalletTx GetValidSproutReceive(const libzcash::SproutSpendingKey& sk, CAmount value, bool randomInputs, int32_t version = 2) {
|
||||||
return GetValidReceive(*params, sk, value, randomInputs, version);
|
return GetValidSproutReceive(*params, sk, value, randomInputs, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
libzcash::SproutNote GetNote(const libzcash::SproutSpendingKey& sk,
|
libzcash::SproutNote GetSproutNote(const libzcash::SproutSpendingKey& sk,
|
||||||
const CTransaction& tx, size_t js, size_t n) {
|
const CTransaction& tx, size_t js, size_t n) {
|
||||||
return GetNote(*params, sk, tx, js, n);
|
return GetSproutNote(*params, sk, tx, js, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWalletTx GetValidSpend(const libzcash::SproutSpendingKey& sk,
|
CWalletTx GetValidSproutSpend(const libzcash::SproutSpendingKey& sk,
|
||||||
const libzcash::SproutNote& note, CAmount value) {
|
const libzcash::SproutNote& note, CAmount value) {
|
||||||
return GetValidSpend(*params, sk, note, value);
|
return GetValidSproutSpend(*params, sk, note, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SaplingOutPoint> SetSaplingNoteData(CWalletTx& wtx) {
|
std::vector<SaplingOutPoint> SetSaplingNoteData(CWalletTx& wtx) {
|
||||||
|
@ -103,8 +103,8 @@ std::pair<JSOutPoint, SaplingOutPoint> CreateValidBlock(TestWallet& wallet,
|
||||||
CBlock& block,
|
CBlock& block,
|
||||||
SproutMerkleTree& sproutTree,
|
SproutMerkleTree& sproutTree,
|
||||||
SaplingMerkleTree& saplingTree) {
|
SaplingMerkleTree& saplingTree) {
|
||||||
auto wtx = GetValidReceive(sk, 50, true, 4);
|
auto wtx = GetValidSproutReceive(sk, 50, true, 4);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -144,8 +144,8 @@ TEST(WalletTests, SetupDatadirLocationRunAsFirstTest) {
|
||||||
|
|
||||||
TEST(WalletTests, SproutNoteDataSerialisation) {
|
TEST(WalletTests, SproutNoteDataSerialisation) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -172,8 +172,8 @@ TEST(WalletTests, FindUnspentSproutNotes) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -230,7 +230,7 @@ TEST(WalletTests, FindUnspentSproutNotes) {
|
||||||
|
|
||||||
|
|
||||||
// Let's spend the note.
|
// Let's spend the note.
|
||||||
auto wtx2 = GetValidSpend(sk, note, 5);
|
auto wtx2 = GetValidSproutSpend(sk, note, 5);
|
||||||
wallet.AddToWallet(wtx2, true, NULL);
|
wallet.AddToWallet(wtx2, true, NULL);
|
||||||
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
||||||
|
|
||||||
|
@ -277,8 +277,8 @@ TEST(WalletTests, FindUnspentSproutNotes) {
|
||||||
// Let's receive a new note
|
// Let's receive a new note
|
||||||
CWalletTx wtx3;
|
CWalletTx wtx3;
|
||||||
{
|
{
|
||||||
auto wtx = GetValidReceive(sk, 20, true);
|
auto wtx = GetValidSproutReceive(sk, 20, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -341,8 +341,8 @@ TEST(WalletTests, FindUnspentSproutNotes) {
|
||||||
|
|
||||||
TEST(WalletTests, SetSproutNoteAddrsInCWalletTx) {
|
TEST(WalletTests, SetSproutNoteAddrsInCWalletTx) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
EXPECT_EQ(0, wtx.mapSproutNoteData.size());
|
EXPECT_EQ(0, wtx.mapSproutNoteData.size());
|
||||||
|
|
||||||
|
@ -451,8 +451,8 @@ TEST(WalletTests, GetSproutNoteNullifier) {
|
||||||
auto address = sk.address();
|
auto address = sk.address();
|
||||||
auto dec = ZCNoteDecryption(sk.receiving_key());
|
auto dec = ZCNoteDecryption(sk.receiving_key());
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
auto hSig = wtx.vjoinsplit[0].h_sig(
|
auto hSig = wtx.vjoinsplit[0].h_sig(
|
||||||
|
@ -529,8 +529,8 @@ TEST(WalletTests, FindMySproutNotes) {
|
||||||
auto sk2 = libzcash::SproutSpendingKey::random();
|
auto sk2 = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk2);
|
wallet.AddSproutSpendingKey(sk2);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
auto noteMap = wallet.FindMySproutNotes(wtx);
|
auto noteMap = wallet.FindMySproutNotes(wtx);
|
||||||
|
@ -557,8 +557,8 @@ TEST(WalletTests, FindMySproutNotesInEncryptedWallet) {
|
||||||
|
|
||||||
ASSERT_TRUE(wallet.EncryptKeys(vMasterKey));
|
ASSERT_TRUE(wallet.EncryptKeys(vMasterKey));
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
auto noteMap = wallet.FindMySproutNotes(wtx);
|
auto noteMap = wallet.FindMySproutNotes(wtx);
|
||||||
|
@ -583,12 +583,12 @@ TEST(WalletTests, GetConflictedSproutNotes) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
auto wtx2 = GetValidSpend(sk, note, 5);
|
auto wtx2 = GetValidSproutSpend(sk, note, 5);
|
||||||
auto wtx3 = GetValidSpend(sk, note, 10);
|
auto wtx3 = GetValidSproutSpend(sk, note, 10);
|
||||||
auto hash2 = wtx2.GetHash();
|
auto hash2 = wtx2.GetHash();
|
||||||
auto hash3 = wtx3.GetHash();
|
auto hash3 = wtx3.GetHash();
|
||||||
|
|
||||||
|
@ -738,8 +738,8 @@ TEST(WalletTests, SproutNullifierIsSpent) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
||||||
|
@ -747,7 +747,7 @@ TEST(WalletTests, SproutNullifierIsSpent) {
|
||||||
wallet.AddToWallet(wtx, true, NULL);
|
wallet.AddToWallet(wtx, true, NULL);
|
||||||
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
||||||
|
|
||||||
auto wtx2 = GetValidSpend(sk, note, 5);
|
auto wtx2 = GetValidSproutSpend(sk, note, 5);
|
||||||
wallet.AddToWallet(wtx2, true, NULL);
|
wallet.AddToWallet(wtx2, true, NULL);
|
||||||
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
EXPECT_FALSE(wallet.IsSproutSpent(nullifier));
|
||||||
|
|
||||||
|
@ -847,8 +847,8 @@ TEST(WalletTests, NavigateFromSproutNullifierToNote) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -977,10 +977,10 @@ TEST(WalletTests, SpentSproutNoteIsFromMe) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
auto wtx2 = GetValidSpend(sk, note, 5);
|
auto wtx2 = GetValidSproutSpend(sk, note, 5);
|
||||||
|
|
||||||
EXPECT_FALSE(wallet.IsFromMe(wtx));
|
EXPECT_FALSE(wallet.IsFromMe(wtx));
|
||||||
EXPECT_FALSE(wallet.IsFromMe(wtx2));
|
EXPECT_FALSE(wallet.IsFromMe(wtx2));
|
||||||
|
@ -1152,9 +1152,9 @@ TEST(WalletTests, CachedWitnessesEmptyChain) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true, 4);
|
auto wtx = GetValidSproutReceive(sk, 10, true, 4);
|
||||||
auto note = GetNote(sk, wtx, 0, 0);
|
auto note = GetSproutNote(sk, wtx, 0, 0);
|
||||||
auto note2 = GetNote(sk, wtx, 0, 1);
|
auto note2 = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
auto nullifier2 = note2.nullifier(sk);
|
auto nullifier2 = note2.nullifier(sk);
|
||||||
|
|
||||||
|
@ -1233,8 +1233,8 @@ TEST(WalletTests, CachedWitnessesChainTip) {
|
||||||
|
|
||||||
{
|
{
|
||||||
// Second transaction
|
// Second transaction
|
||||||
auto wtx = GetValidReceive(sk, 50, true, 4);
|
auto wtx = GetValidSproutReceive(sk, 50, true, 4);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t sproutNoteData;
|
mapSproutNoteData_t sproutNoteData;
|
||||||
|
@ -1342,8 +1342,8 @@ TEST(WalletTests, CachedWitnessesDecrementFirst) {
|
||||||
|
|
||||||
{
|
{
|
||||||
// Third transaction - never mined
|
// Third transaction - never mined
|
||||||
auto wtx = GetValidReceive(sk, 20, true, 4);
|
auto wtx = GetValidSproutReceive(sk, 20, true, 4);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -1480,9 +1480,9 @@ TEST(WalletTests, ClearNoteWitnessCache) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true, 4);
|
auto wtx = GetValidSproutReceive(sk, 10, true, 4);
|
||||||
auto hash = wtx.GetHash();
|
auto hash = wtx.GetHash();
|
||||||
auto note = GetNote(sk, wtx, 0, 0);
|
auto note = GetSproutNote(sk, wtx, 0, 0);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -1540,8 +1540,8 @@ TEST(WalletTests, WriteWitnessCache) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -1642,16 +1642,16 @@ TEST(WalletTests, SetBestChainIgnoresTxsWithoutShieldedData) {
|
||||||
wallet.AddToWallet(wtxTransparent, true, nullptr);
|
wallet.AddToWallet(wtxTransparent, true, nullptr);
|
||||||
|
|
||||||
// Generate a Sprout transaction that is ours
|
// Generate a Sprout transaction that is ours
|
||||||
auto wtxSprout = GetValidReceive(sk, 10, true);
|
auto wtxSprout = GetValidSproutReceive(sk, 10, true);
|
||||||
auto noteMap = wallet.FindMySproutNotes(wtxSprout);
|
auto noteMap = wallet.FindMySproutNotes(wtxSprout);
|
||||||
wtxSprout.SetSproutNoteData(noteMap);
|
wtxSprout.SetSproutNoteData(noteMap);
|
||||||
wallet.AddToWallet(wtxSprout, true, nullptr);
|
wallet.AddToWallet(wtxSprout, true, nullptr);
|
||||||
|
|
||||||
// Generate a Sprout transaction that only involves our transparent address
|
// Generate a Sprout transaction that only involves our transparent address
|
||||||
auto sk2 = libzcash::SproutSpendingKey::random();
|
auto sk2 = libzcash::SproutSpendingKey::random();
|
||||||
auto wtxInput = GetValidReceive(sk2, 10, true);
|
auto wtxInput = GetValidSproutReceive(sk2, 10, true);
|
||||||
auto note = GetNote(sk2, wtxInput, 0, 0);
|
auto note = GetSproutNote(sk2, wtxInput, 0, 0);
|
||||||
auto wtxTmp = GetValidSpend(sk2, note, 5);
|
auto wtxTmp = GetValidSproutSpend(sk2, note, 5);
|
||||||
CMutableTransaction mtx {wtxTmp};
|
CMutableTransaction mtx {wtxTmp};
|
||||||
mtx.vout[0].scriptPubKey = scriptPubKey;
|
mtx.vout[0].scriptPubKey = scriptPubKey;
|
||||||
CWalletTx wtxSproutTransparent {nullptr, mtx};
|
CWalletTx wtxSproutTransparent {nullptr, mtx};
|
||||||
|
@ -1709,8 +1709,8 @@ TEST(WalletTests, UpdateSproutNullifierNoteMap) {
|
||||||
|
|
||||||
ASSERT_TRUE(wallet.EncryptKeys(vMasterKey));
|
ASSERT_TRUE(wallet.EncryptKeys(vMasterKey));
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
// Pretend that we called FindMySproutNotes while the wallet was locked
|
// Pretend that we called FindMySproutNotes while the wallet was locked
|
||||||
|
@ -1740,9 +1740,9 @@ TEST(WalletTests, UpdatedSproutNoteData) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto note = GetNote(sk, wtx, 0, 0);
|
auto note = GetSproutNote(sk, wtx, 0, 0);
|
||||||
auto note2 = GetNote(sk, wtx, 0, 1);
|
auto note2 = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
auto nullifier2 = note2.nullifier(sk);
|
auto nullifier2 = note2.nullifier(sk);
|
||||||
auto wtx2 = wtx;
|
auto wtx2 = wtx;
|
||||||
|
@ -1909,11 +1909,11 @@ TEST(WalletTests, MarkAffectedSproutTransactionsDirty) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto hash = wtx.GetHash();
|
auto hash = wtx.GetHash();
|
||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetSproutNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
auto wtx2 = GetValidSpend(sk, note, 5);
|
auto wtx2 = GetValidSproutSpend(sk, note, 5);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
JSOutPoint jsoutpt {hash, 0, 1};
|
JSOutPoint jsoutpt {hash, 0, 1};
|
||||||
|
@ -2058,8 +2058,8 @@ TEST(WalletTests, SproutNoteLocking) {
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
auto wtx = GetValidReceive(sk, 10, true);
|
auto wtx = GetValidSproutReceive(sk, 10, true);
|
||||||
auto wtx2 = GetValidReceive(sk, 10, true);
|
auto wtx2 = GetValidSproutReceive(sk, 10, true);
|
||||||
|
|
||||||
JSOutPoint jsoutpt {wtx.GetHash(), 0, 0};
|
JSOutPoint jsoutpt {wtx.GetHash(), 0, 0};
|
||||||
JSOutPoint jsoutpt2 {wtx2.GetHash(),0, 0};
|
JSOutPoint jsoutpt2 {wtx2.GetHash(),0, 0};
|
||||||
|
|
|
@ -289,7 +289,7 @@ double benchmark_try_decrypt_notes(size_t nAddrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
auto tx = GetValidReceive(*pzcashParams, sk, 10, true);
|
auto tx = GetValidSproutReceive(*pzcashParams, sk, 10, true);
|
||||||
|
|
||||||
struct timeval tv_start;
|
struct timeval tv_start;
|
||||||
timer_start(tv_start);
|
timer_start(tv_start);
|
||||||
|
@ -309,8 +309,8 @@ double benchmark_increment_note_witnesses(size_t nTxs)
|
||||||
// First block
|
// First block
|
||||||
CBlock block1;
|
CBlock block1;
|
||||||
for (int i = 0; i < nTxs; i++) {
|
for (int i = 0; i < nTxs; i++) {
|
||||||
auto wtx = GetValidReceive(*pzcashParams, sk, 10, true);
|
auto wtx = GetValidSproutReceive(*pzcashParams, sk, 10, true);
|
||||||
auto note = GetNote(*pzcashParams, sk, wtx, 0, 1);
|
auto note = GetSproutNote(*pzcashParams, sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
@ -332,8 +332,8 @@ double benchmark_increment_note_witnesses(size_t nTxs)
|
||||||
CBlock block2;
|
CBlock block2;
|
||||||
block2.hashPrevBlock = block1.GetHash();
|
block2.hashPrevBlock = block1.GetHash();
|
||||||
{
|
{
|
||||||
auto wtx = GetValidReceive(*pzcashParams, sk, 10, true);
|
auto wtx = GetValidSproutReceive(*pzcashParams, sk, 10, true);
|
||||||
auto note = GetNote(*pzcashParams, sk, wtx, 0, 1);
|
auto note = GetSproutNote(*pzcashParams, sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
mapSproutNoteData_t noteData;
|
mapSproutNoteData_t noteData;
|
||||||
|
|
Loading…
Reference in New Issue