2023-01-23 10:31:54 -08:00
|
|
|
// Copyright (c) 2017-2023 The Zcash developers
|
2017-12-11 08:43:09 -08:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2019-07-18 07:16:09 -07:00
|
|
|
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
2017-12-11 08:43:09 -08:00
|
|
|
|
2020-10-27 04:46:32 -07:00
|
|
|
#ifndef ZCASH_WALLET_ASYNCRPCOPERATION_MERGETOADDRESS_H
|
|
|
|
#define ZCASH_WALLET_ASYNCRPCOPERATION_MERGETOADDRESS_H
|
2017-12-11 08:43:09 -08:00
|
|
|
|
|
|
|
#include "amount.h"
|
|
|
|
#include "asyncrpcoperation.h"
|
|
|
|
#include "primitives/transaction.h"
|
2018-10-18 14:37:58 -07:00
|
|
|
#include "transaction_builder.h"
|
2023-04-17 03:21:54 -07:00
|
|
|
#include "uint256.h"
|
2017-12-11 08:43:09 -08:00
|
|
|
#include "wallet.h"
|
2019-03-05 13:04:23 -08:00
|
|
|
#include "wallet/paymentdisclosure.h"
|
2023-04-17 03:21:54 -07:00
|
|
|
#include "wallet/wallet_tx_builder.h"
|
2017-12-11 08:43:09 -08:00
|
|
|
#include "zcash/Address.hpp"
|
|
|
|
#include "zcash/JoinSplit.hpp"
|
|
|
|
|
2018-05-03 03:53:51 -07:00
|
|
|
#include <array>
|
2020-10-20 17:39:13 -07:00
|
|
|
#include <optional>
|
2017-12-11 08:43:09 -08:00
|
|
|
#include <tuple>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
#include <univalue.h>
|
|
|
|
|
2022-06-06 15:17:07 -07:00
|
|
|
#include <rust/ed25519.h>
|
2020-07-31 07:15:04 -07:00
|
|
|
|
2017-12-11 08:43:09 -08:00
|
|
|
using namespace libzcash;
|
|
|
|
|
|
|
|
// Package of info which is passed to perform_joinsplit methods.
|
|
|
|
struct MergeToAddressJSInfo {
|
|
|
|
std::vector<JSInput> vjsin;
|
|
|
|
std::vector<JSOutput> vjsout;
|
2018-04-24 21:20:01 -07:00
|
|
|
std::vector<SproutNote> notes;
|
2018-04-25 18:51:17 -07:00
|
|
|
std::vector<SproutSpendingKey> zkeys;
|
2017-12-11 08:43:09 -08:00
|
|
|
CAmount vpub_old = 0;
|
|
|
|
CAmount vpub_new = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// A struct to help us track the witness and anchor for a given JSOutPoint
|
|
|
|
struct MergeToAddressWitnessAnchorData {
|
2020-10-20 17:44:15 -07:00
|
|
|
std::optional<SproutWitness> witness;
|
2017-12-11 08:43:09 -08:00
|
|
|
uint256 anchor;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AsyncRPCOperation_mergetoaddress : public AsyncRPCOperation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AsyncRPCOperation_mergetoaddress(
|
2023-04-19 15:25:40 -07:00
|
|
|
CWallet& wallet,
|
|
|
|
TransactionStrategy strategy,
|
|
|
|
TransactionEffects effects,
|
|
|
|
UniValue contextInfo = NullUniValue);
|
2017-12-11 08:43:09 -08:00
|
|
|
virtual ~AsyncRPCOperation_mergetoaddress();
|
|
|
|
|
|
|
|
// We don't want to be copied or moved around
|
|
|
|
AsyncRPCOperation_mergetoaddress(AsyncRPCOperation_mergetoaddress const&) = delete; // Copy construct
|
|
|
|
AsyncRPCOperation_mergetoaddress(AsyncRPCOperation_mergetoaddress&&) = delete; // Move construct
|
|
|
|
AsyncRPCOperation_mergetoaddress& operator=(AsyncRPCOperation_mergetoaddress const&) = delete; // Copy assign
|
|
|
|
AsyncRPCOperation_mergetoaddress& operator=(AsyncRPCOperation_mergetoaddress&&) = delete; // Move assign
|
|
|
|
|
|
|
|
virtual void main();
|
|
|
|
|
|
|
|
virtual UniValue getStatus() const;
|
|
|
|
|
2023-04-19 15:25:40 -07:00
|
|
|
/// Set to true to disable sending txs and generating proofs
|
|
|
|
bool testmode = false;
|
2017-12-11 08:43:09 -08:00
|
|
|
|
|
|
|
private:
|
2023-04-19 15:25:40 -07:00
|
|
|
const TransactionStrategy strategy_;
|
2017-12-11 08:43:09 -08:00
|
|
|
|
2023-04-19 15:25:40 -07:00
|
|
|
const TransactionEffects effects_;
|
2017-12-11 08:43:09 -08:00
|
|
|
|
2023-04-19 15:25:40 -07:00
|
|
|
/// optional data to include in return value from getStatus()
|
|
|
|
UniValue contextinfo_;
|
2017-12-11 08:43:09 -08:00
|
|
|
};
|
|
|
|
|
2020-10-27 04:46:32 -07:00
|
|
|
#endif // ZCASH_WALLET_ASYNCRPCOPERATION_MERGETOADDRESS_H
|