Rename Witnesses to include sprout or sapling
This commit is contained in:
@@ -327,12 +327,12 @@ for test_input in TEST_VECTORS:
|
||||
|
||||
void increment_note_witnesses(
|
||||
const uint256& element,
|
||||
std::vector<ZCIncrementalWitness>& witnesses,
|
||||
std::vector<SproutWitness>& witnesses,
|
||||
SproutMerkleTree& tree
|
||||
)
|
||||
{
|
||||
tree.append(element);
|
||||
for (ZCIncrementalWitness& w : witnesses) {
|
||||
for (SproutWitness& w : witnesses) {
|
||||
w.append(element);
|
||||
}
|
||||
witnesses.push_back(tree.witness());
|
||||
@@ -341,7 +341,7 @@ void increment_note_witnesses(
|
||||
TEST(joinsplit, full_api_test)
|
||||
{
|
||||
{
|
||||
std::vector<ZCIncrementalWitness> witnesses;
|
||||
std::vector<SproutWitness> witnesses;
|
||||
SproutMerkleTree tree;
|
||||
increment_note_witnesses(uint256(), witnesses, tree);
|
||||
SproutSpendingKey sk = SproutSpendingKey::random();
|
||||
|
||||
@@ -1200,7 +1200,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||
static_cast<AsyncRPCOperation_sendmany *>(operation.get())->testmode = true;
|
||||
|
||||
AsyncJoinSplitInfo info;
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional < SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
try {
|
||||
proxy.perform_joinsplit(info, witnesses, anchor);
|
||||
@@ -1736,7 +1736,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_internals)
|
||||
static_cast<AsyncRPCOperation_sendmany *>(operation.get())->testmode = true;
|
||||
|
||||
MergeToAddressJSInfo info;
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional < SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
try {
|
||||
proxy.perform_joinsplit(info, witnesses, anchor);
|
||||
|
||||
@@ -15,7 +15,7 @@ SpendDescriptionInfo::SpendDescriptionInfo(
|
||||
libzcash::SaplingExpandedSpendingKey expsk,
|
||||
libzcash::SaplingNote note,
|
||||
uint256 anchor,
|
||||
ZCSaplingIncrementalWitness witness) : expsk(expsk), note(note), anchor(anchor), witness(witness)
|
||||
SaplingWitness witness) : expsk(expsk), note(note), anchor(anchor), witness(witness)
|
||||
{
|
||||
librustzcash_sapling_generate_r(alpha.begin());
|
||||
}
|
||||
@@ -32,7 +32,7 @@ bool TransactionBuilder::AddSaplingSpend(
|
||||
libzcash::SaplingExpandedSpendingKey expsk,
|
||||
libzcash::SaplingNote note,
|
||||
uint256 anchor,
|
||||
ZCSaplingIncrementalWitness witness)
|
||||
SaplingWitness witness)
|
||||
{
|
||||
// Consistency check: all anchors must equal the first one
|
||||
if (!spends.empty()) {
|
||||
|
||||
@@ -23,13 +23,13 @@ struct SpendDescriptionInfo {
|
||||
libzcash::SaplingNote note;
|
||||
uint256 alpha;
|
||||
uint256 anchor;
|
||||
ZCSaplingIncrementalWitness witness;
|
||||
SaplingWitness witness;
|
||||
|
||||
SpendDescriptionInfo(
|
||||
libzcash::SaplingExpandedSpendingKey expsk,
|
||||
libzcash::SaplingNote note,
|
||||
uint256 anchor,
|
||||
ZCSaplingIncrementalWitness witness);
|
||||
SaplingWitness witness);
|
||||
};
|
||||
|
||||
struct OutputDescriptionInfo {
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
libzcash::SaplingExpandedSpendingKey expsk,
|
||||
libzcash::SaplingNote note,
|
||||
uint256 anchor,
|
||||
ZCSaplingIncrementalWitness witness);
|
||||
SaplingWitness witness);
|
||||
|
||||
void AddSaplingOutput(
|
||||
libzcash::SaplingFullViewingKey from,
|
||||
|
||||
@@ -342,7 +342,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||
JSOutPoint jso = std::get<0>(t);
|
||||
std::vector<JSOutPoint> vOutPoints = {jso};
|
||||
uint256 inputAnchor;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
||||
std::vector<boost::optional<SproutWitness>> vInputWitnesses;
|
||||
pwalletMain->GetSproutNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor);
|
||||
jsopWitnessAnchorMap[jso.ToString()] = MergeToAddressWitnessAnchorData{vInputWitnesses[0], inputAnchor};
|
||||
}
|
||||
@@ -406,7 +406,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||
|
||||
CAmount jsInputValue = 0;
|
||||
uint256 jsAnchor;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional<SproutWitness>> witnesses;
|
||||
|
||||
JSDescription prevJoinSplit;
|
||||
|
||||
@@ -437,7 +437,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||
}
|
||||
|
||||
assert(changeOutputIndex != -1);
|
||||
boost::optional<ZCIncrementalWitness> changeWitness;
|
||||
boost::optional<SproutWitness> changeWitness;
|
||||
int n = 0;
|
||||
for (const uint256& commitment : prevJoinSplit.commitments) {
|
||||
tree.append(commitment);
|
||||
@@ -487,7 +487,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||
std::vector<SproutNote> vInputNotes;
|
||||
std::vector<SproutSpendingKey> vInputZKeys;
|
||||
std::vector<JSOutPoint> vOutPoints;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
||||
std::vector<boost::optional<SproutWitness>> vInputWitnesses;
|
||||
uint256 inputAnchor;
|
||||
int numInputsNeeded = (jsChange > 0) ? 1 : 0;
|
||||
while (numInputsNeeded++ < ZC_NUM_JS_INPUTS && zInputsDeque.size() > 0) {
|
||||
@@ -544,7 +544,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||
if (!optionalWitness) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Witness for note commitment is null");
|
||||
}
|
||||
ZCIncrementalWitness w = *optionalWitness; // could use .get();
|
||||
SproutWitness w = *optionalWitness; // could use .get();
|
||||
if (jsChange > 0) {
|
||||
for (const uint256& commitment : previousCommitments) {
|
||||
w.append(commitment);
|
||||
@@ -695,7 +695,7 @@ void AsyncRPCOperation_mergetoaddress::sign_send_raw_transaction(UniValue obj)
|
||||
|
||||
UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(MergeToAddressJSInfo& info)
|
||||
{
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional<SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
@@ -707,7 +707,7 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(MergeToAddressJSInf
|
||||
|
||||
UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(MergeToAddressJSInfo& info, std::vector<JSOutPoint>& outPoints)
|
||||
{
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional<SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
@@ -718,7 +718,7 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(MergeToAddressJSInf
|
||||
|
||||
UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(
|
||||
MergeToAddressJSInfo& info,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses,
|
||||
std::vector<boost::optional<SproutWitness>> witnesses,
|
||||
uint256 anchor)
|
||||
{
|
||||
if (anchor.IsNull()) {
|
||||
|
||||
@@ -45,7 +45,7 @@ struct MergeToAddressJSInfo {
|
||||
|
||||
// A struct to help us track the witness and anchor for a given JSOutPoint
|
||||
struct MergeToAddressWitnessAnchorData {
|
||||
boost::optional<ZCIncrementalWitness> witness;
|
||||
boost::optional<SproutWitness> witness;
|
||||
uint256 anchor;
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
// JoinSplit where you have the witnesses and anchor
|
||||
UniValue perform_joinsplit(
|
||||
MergeToAddressJSInfo& info,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses,
|
||||
std::vector<boost::optional<SproutWitness>> witnesses,
|
||||
uint256 anchor);
|
||||
|
||||
void sign_send_raw_transaction(UniValue obj); // throws exception if there was an error
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
UniValue perform_joinsplit(
|
||||
MergeToAddressJSInfo& info,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses,
|
||||
std::vector<boost::optional<SproutWitness>> witnesses,
|
||||
uint256 anchor)
|
||||
{
|
||||
return delegate->perform_joinsplit(info, witnesses, anchor);
|
||||
|
||||
@@ -419,7 +419,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
JSOutPoint jso = std::get<0>(t);
|
||||
std::vector<JSOutPoint> vOutPoints = { jso };
|
||||
uint256 inputAnchor;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
||||
std::vector<boost::optional<SproutWitness>> vInputWitnesses;
|
||||
pwalletMain->GetSproutNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor);
|
||||
jsopWitnessAnchorMap[ jso.ToString() ] = WitnessAnchorData{ vInputWitnesses[0], inputAnchor };
|
||||
}
|
||||
@@ -526,7 +526,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
CAmount jsInputValue = 0;
|
||||
uint256 jsAnchor;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional<SproutWitness>> witnesses;
|
||||
|
||||
JSDescription prevJoinSplit;
|
||||
|
||||
@@ -557,7 +557,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
}
|
||||
|
||||
assert(changeOutputIndex != -1);
|
||||
boost::optional<ZCIncrementalWitness> changeWitness;
|
||||
boost::optional<SproutWitness> changeWitness;
|
||||
int n = 0;
|
||||
for (const uint256& commitment : prevJoinSplit.commitments) {
|
||||
tree.append(commitment);
|
||||
@@ -606,7 +606,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
//
|
||||
std::vector<SproutNote> vInputNotes;
|
||||
std::vector<JSOutPoint> vOutPoints;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
||||
std::vector<boost::optional<SproutWitness>> vInputWitnesses;
|
||||
uint256 inputAnchor;
|
||||
int numInputsNeeded = (jsChange>0) ? 1 : 0;
|
||||
while (numInputsNeeded++ < ZC_NUM_JS_INPUTS && zInputsDeque.size() > 0) {
|
||||
@@ -663,7 +663,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
if (!optionalWitness) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Witness for note commitment is null");
|
||||
}
|
||||
ZCIncrementalWitness w = *optionalWitness; // could use .get();
|
||||
SproutWitness w = *optionalWitness; // could use .get();
|
||||
if (jsChange > 0) {
|
||||
for (const uint256& commitment : previousCommitments) {
|
||||
w.append(commitment);
|
||||
@@ -920,7 +920,7 @@ bool AsyncRPCOperation_sendmany::find_unspent_notes() {
|
||||
}
|
||||
|
||||
UniValue AsyncRPCOperation_sendmany::perform_joinsplit(AsyncJoinSplitInfo & info) {
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional < SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
@@ -931,7 +931,7 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(AsyncJoinSplitInfo & info
|
||||
|
||||
|
||||
UniValue AsyncRPCOperation_sendmany::perform_joinsplit(AsyncJoinSplitInfo & info, std::vector<JSOutPoint> & outPoints) {
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional < SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
@@ -942,7 +942,7 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(AsyncJoinSplitInfo & info
|
||||
|
||||
UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
|
||||
AsyncJoinSplitInfo & info,
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses,
|
||||
std::vector<boost::optional < SproutWitness>> witnesses,
|
||||
uint256 anchor)
|
||||
{
|
||||
if (anchor.IsNull()) {
|
||||
|
||||
@@ -45,7 +45,7 @@ struct AsyncJoinSplitInfo
|
||||
|
||||
// A struct to help us track the witness and anchor for a given JSOutPoint
|
||||
struct WitnessAnchorData {
|
||||
boost::optional<ZCIncrementalWitness> witness;
|
||||
boost::optional<SproutWitness> witness;
|
||||
uint256 anchor;
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
// JoinSplit where you have the witnesses and anchor
|
||||
UniValue perform_joinsplit(
|
||||
AsyncJoinSplitInfo & info,
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses,
|
||||
std::vector<boost::optional < SproutWitness>> witnesses,
|
||||
uint256 anchor);
|
||||
|
||||
void sign_send_raw_transaction(UniValue obj); // throws exception if there was an error
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
|
||||
UniValue perform_joinsplit(
|
||||
AsyncJoinSplitInfo & info,
|
||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses,
|
||||
std::vector<boost::optional < SproutWitness>> witnesses,
|
||||
uint256 anchor)
|
||||
{
|
||||
return delegate->perform_joinsplit(info, witnesses, anchor);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2843,7 +2843,7 @@ UniValue zc_raw_receive(const UniValue& params, bool fHelp)
|
||||
SproutNote decrypted_note = npt.note(payment_addr);
|
||||
|
||||
assert(pwalletMain != NULL);
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional<SproutWitness>> witnesses;
|
||||
uint256 anchor;
|
||||
uint256 commitment = decrypted_note.cm();
|
||||
pwalletMain->WitnessNoteCommitment(
|
||||
@@ -2944,7 +2944,7 @@ UniValue zc_raw_joinsplit(const UniValue& params, bool fHelp)
|
||||
}
|
||||
|
||||
uint256 anchor;
|
||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
||||
std::vector<boost::optional<SproutWitness>> witnesses;
|
||||
pwalletMain->WitnessNoteCommitment(commitments, witnesses, anchor);
|
||||
|
||||
assert(witnesses.size() == notes.size());
|
||||
|
||||
@@ -1470,7 +1470,7 @@ bool CWallet::IsFromMe(const uint256& nullifier) const
|
||||
}
|
||||
|
||||
void CWallet::GetSproutNoteWitnesses(std::vector<JSOutPoint> notes,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>>& witnesses,
|
||||
std::vector<boost::optional<SproutWitness>>& witnesses,
|
||||
uint256 &final_anchor)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
@@ -1497,7 +1497,7 @@ void CWallet::GetSproutNoteWitnesses(std::vector<JSOutPoint> notes,
|
||||
}
|
||||
|
||||
void CWallet::GetSaplingNoteWitnesses(std::vector<SaplingOutPoint> notes,
|
||||
std::vector<boost::optional<ZCSaplingIncrementalWitness>>& witnesses,
|
||||
std::vector<boost::optional<SaplingWitness>>& witnesses,
|
||||
uint256 &final_anchor)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
@@ -1888,7 +1888,7 @@ bool CWalletTx::WriteToDisk(CWalletDB *pwalletdb)
|
||||
}
|
||||
|
||||
void CWallet::WitnessNoteCommitment(std::vector<uint256> commitments,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>>& witnesses,
|
||||
std::vector<boost::optional<SproutWitness>>& witnesses,
|
||||
uint256 &final_anchor)
|
||||
{
|
||||
witnesses.resize(commitments.size());
|
||||
@@ -1907,7 +1907,7 @@ void CWallet::WitnessNoteCommitment(std::vector<uint256> commitments,
|
||||
{
|
||||
tree.append(note_commitment);
|
||||
|
||||
BOOST_FOREACH(boost::optional<ZCIncrementalWitness>& wit, witnesses) {
|
||||
BOOST_FOREACH(boost::optional<SproutWitness>& wit, witnesses) {
|
||||
if (wit) {
|
||||
wit->append(note_commitment);
|
||||
}
|
||||
@@ -1937,7 +1937,7 @@ void CWallet::WitnessNoteCommitment(std::vector<uint256> commitments,
|
||||
// TODO: #93; Select a root via some heuristic.
|
||||
final_anchor = tree.root();
|
||||
|
||||
BOOST_FOREACH(boost::optional<ZCIncrementalWitness>& wit, witnesses) {
|
||||
BOOST_FOREACH(boost::optional<SproutWitness>& wit, witnesses) {
|
||||
if (wit) {
|
||||
assert(final_anchor == wit->root());
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
* Cached incremental witnesses for spendable Notes.
|
||||
* Beginning of the list is the most recent witness.
|
||||
*/
|
||||
std::list<ZCIncrementalWitness> witnesses;
|
||||
std::list<SproutWitness> witnesses;
|
||||
|
||||
/**
|
||||
* Block height corresponding to the most current witness.
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
*/
|
||||
SaplingNoteData() : witnessHeight {-1} { }
|
||||
|
||||
std::list<ZCSaplingIncrementalWitness> witnesses;
|
||||
std::list<SaplingWitness> witnesses;
|
||||
int witnessHeight;
|
||||
};
|
||||
|
||||
@@ -1033,7 +1033,7 @@ public:
|
||||
void EraseFromWallet(const uint256 &hash);
|
||||
void WitnessNoteCommitment(
|
||||
std::vector<uint256> commitments,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>>& witnesses,
|
||||
std::vector<boost::optional<SproutWitness>>& witnesses,
|
||||
uint256 &final_anchor);
|
||||
int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
|
||||
void ReacceptWalletTransactions();
|
||||
@@ -1077,11 +1077,11 @@ public:
|
||||
bool IsFromMe(const uint256& nullifier) const;
|
||||
void GetSproutNoteWitnesses(
|
||||
std::vector<JSOutPoint> notes,
|
||||
std::vector<boost::optional<ZCIncrementalWitness>>& witnesses,
|
||||
std::vector<boost::optional<SproutWitness>>& witnesses,
|
||||
uint256 &final_anchor);
|
||||
void GetSaplingNoteWitnesses(
|
||||
std::vector<SaplingOutPoint> notes,
|
||||
std::vector<boost::optional<ZCSaplingIncrementalWitness>>& witnesses,
|
||||
std::vector<boost::optional<SaplingWitness>>& witnesses,
|
||||
uint256 &final_anchor);
|
||||
|
||||
isminetype IsMine(const CTxIn& txin) const;
|
||||
|
||||
@@ -251,13 +251,13 @@ EmptyMerkleRoots<Depth, Hash> IncrementalMerkleTree<Depth, Hash>::emptyroots;
|
||||
typedef libzcash::IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::SHA256Compress> SproutMerkleTree;
|
||||
typedef libzcash::IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::SHA256Compress> ZCTestingIncrementalMerkleTree;
|
||||
|
||||
typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::SHA256Compress> ZCIncrementalWitness;
|
||||
typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::SHA256Compress> SproutWitness;
|
||||
typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::SHA256Compress> ZCTestingIncrementalWitness;
|
||||
|
||||
typedef libzcash::IncrementalMerkleTree<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::PedersenHash> SaplingMerkleTree;
|
||||
typedef libzcash::IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::PedersenHash> ZCSaplingTestingIncrementalMerkleTree;
|
||||
|
||||
typedef libzcash::IncrementalWitness<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::PedersenHash> ZCSaplingIncrementalWitness;
|
||||
typedef libzcash::IncrementalWitness<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::PedersenHash> SaplingWitness;
|
||||
typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::PedersenHash> ZCSaplingTestingIncrementalWitness;
|
||||
|
||||
#endif /* ZC_INCREMENTALMERKLETREE_H_ */
|
||||
|
||||
@@ -25,12 +25,12 @@ typedef boost::variant<PHGRProof, GrothProof> SproutProof;
|
||||
|
||||
class JSInput {
|
||||
public:
|
||||
ZCIncrementalWitness witness;
|
||||
SproutWitness witness;
|
||||
SproutNote note;
|
||||
SproutSpendingKey key;
|
||||
|
||||
JSInput();
|
||||
JSInput(ZCIncrementalWitness witness,
|
||||
JSInput(SproutWitness witness,
|
||||
SproutNote note,
|
||||
SproutSpendingKey key) : witness(witness), note(note), key(key) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user