[wallet] CBitcoinAddress->CTxDestination and related, includes
This commit is contained in:
parent
2a6d9c51e2
commit
8073709070
|
@ -23,6 +23,7 @@
|
||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
#include <wallet/walletdb.h>
|
#include <wallet/walletdb.h>
|
||||||
#include <zcash/IncrementalMerkleTree.hpp>
|
#include <zcash/IncrementalMerkleTree.hpp>
|
||||||
|
#include <key_io.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -73,8 +74,8 @@ AsyncRPCOperation_mergetoaddress::AsyncRPCOperation_mergetoaddress(
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Recipient parameter missing");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Recipient parameter missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
toTaddr_ = CBitcoinAddress(std::get<0>(recipient));
|
toTaddr_ = DecodeDestination(std::get<0>(recipient));
|
||||||
isToTaddr_ = toTaddr_.IsValid();
|
isToTaddr_ = IsValidDestination(toTaddr_);
|
||||||
isToZaddr_ = false;
|
isToZaddr_ = false;
|
||||||
|
|
||||||
if (!isToTaddr_) {
|
if (!isToTaddr_) {
|
||||||
|
@ -246,7 +247,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||||
rawTx.vin.push_back(in);
|
rawTx.vin.push_back(in);
|
||||||
}
|
}
|
||||||
if (isToTaddr_) {
|
if (isToTaddr_) {
|
||||||
CScript scriptPubKey = GetScriptForDestination(toTaddr_.Get());
|
CScript scriptPubKey = GetScriptForDestination(toTaddr_);
|
||||||
CTxOut out(sendAmount, scriptPubKey);
|
CTxOut out(sendAmount, scriptPubKey);
|
||||||
rawTx.vout.push_back(out);
|
rawTx.vout.push_back(out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ private:
|
||||||
MergeToAddressRecipient recipient_;
|
MergeToAddressRecipient recipient_;
|
||||||
bool isToTaddr_;
|
bool isToTaddr_;
|
||||||
bool isToZaddr_;
|
bool isToZaddr_;
|
||||||
CBitcoinAddress toTaddr_;
|
CTxDestination toTaddr_;
|
||||||
PaymentAddress toPaymentAddress_;
|
PaymentAddress toPaymentAddress_;
|
||||||
|
|
||||||
uint256 joinSplitPubKey_;
|
uint256 joinSplitPubKey_;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <rpcserver.h>
|
#include <rpc/server.h>
|
||||||
#include <timedata.h>
|
#include <timedata.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <utilmoneystr.h>
|
#include <utilmoneystr.h>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
#include <script/interpreter.h>
|
#include <script/interpreter.h>
|
||||||
#include <utiltime.h>
|
#include <utiltime.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
#include <rpcprotocol.h>
|
#include <rpc/protocol.h>
|
||||||
#include <zcash/IncrementalMerkleTree.hpp>
|
#include <zcash/IncrementalMerkleTree.hpp>
|
||||||
#include <sodium.h>
|
#include <sodium.h>
|
||||||
#include <miner.h>
|
#include <miner.h>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <wallet/paymentdisclosuredb.h>
|
#include <paymentdisclosuredb.h>
|
||||||
|
|
||||||
using namespace libzcash;
|
using namespace libzcash;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "No recipients");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "No recipients");
|
||||||
}
|
}
|
||||||
|
|
||||||
fromtaddr_ = CBitcoinAddress(fromAddress);
|
fromtaddr_ = DecodeDestination(fromAddress);
|
||||||
isfromtaddr_ = fromtaddr_.IsValid();
|
isfromtaddr_ = fromtaddr_.IsValid();
|
||||||
isfromzaddr_ = false;
|
isfromzaddr_ = false;
|
||||||
|
|
||||||
|
@ -829,7 +829,7 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
|
||||||
|
|
||||||
|
|
||||||
bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) {
|
bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) {
|
||||||
set<CBitcoinAddress> setAddress = {fromtaddr_};
|
set<CTxDestination> setAddress = {fromtaddr_};
|
||||||
vector<COutput> vecOutputs;
|
vector<COutput> vecOutputs;
|
||||||
|
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||||
|
@ -1101,12 +1101,12 @@ void AsyncRPCOperation_sendmany::add_taddr_outputs_to_tx() {
|
||||||
std::string outputAddress = std::get<0>(r);
|
std::string outputAddress = std::get<0>(r);
|
||||||
CAmount nAmount = std::get<1>(r);
|
CAmount nAmount = std::get<1>(r);
|
||||||
|
|
||||||
CBitcoinAddress address(outputAddress);
|
CTxDestination address = DecodeDestination(outputAddress);
|
||||||
if (!address.IsValid()) {
|
if (!IsValidDestination(address)) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid output address, not a valid taddr.");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid output address, not a valid taddr.");
|
||||||
}
|
}
|
||||||
|
|
||||||
CScript scriptPubKey = GetScriptForDestination(address.Get());
|
CScript scriptPubKey = GetScriptForDestination(address);
|
||||||
|
|
||||||
CTxOut out(nAmount, scriptPubKey);
|
CTxOut out(nAmount, scriptPubKey);
|
||||||
rawTx.vout.push_back(out);
|
rawTx.vout.push_back(out);
|
||||||
|
|
|
@ -79,7 +79,7 @@ private:
|
||||||
std::string fromaddress_;
|
std::string fromaddress_;
|
||||||
bool isfromtaddr_;
|
bool isfromtaddr_;
|
||||||
bool isfromzaddr_;
|
bool isfromzaddr_;
|
||||||
CBitcoinAddress fromtaddr_;
|
CTxDestination fromtaddr_;
|
||||||
PaymentAddress frompaymentaddress_;
|
PaymentAddress frompaymentaddress_;
|
||||||
SpendingKey spendingkey_;
|
SpendingKey spendingkey_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue