[wallet] CBitcoinAddress->CTxDestination and related, includes

This commit is contained in:
Jon Layton 2018-06-04 13:51:36 -05:00
parent 2a6d9c51e2
commit 8073709070
4 changed files with 15 additions and 14 deletions

View File

@ -23,6 +23,7 @@
#include <wallet/wallet.h>
#include <wallet/walletdb.h>
#include <zcash/IncrementalMerkleTree.hpp>
#include <key_io.h>
#include <chrono>
#include <iostream>
@ -73,8 +74,8 @@ AsyncRPCOperation_mergetoaddress::AsyncRPCOperation_mergetoaddress(
throw JSONRPCError(RPC_INVALID_PARAMETER, "Recipient parameter missing");
}
toTaddr_ = CBitcoinAddress(std::get<0>(recipient));
isToTaddr_ = toTaddr_.IsValid();
toTaddr_ = DecodeDestination(std::get<0>(recipient));
isToTaddr_ = IsValidDestination(toTaddr_);
isToZaddr_ = false;
if (!isToTaddr_) {
@ -246,7 +247,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
rawTx.vin.push_back(in);
}
if (isToTaddr_) {
CScript scriptPubKey = GetScriptForDestination(toTaddr_.Get());
CScript scriptPubKey = GetScriptForDestination(toTaddr_);
CTxOut out(sendAmount, scriptPubKey);
rawTx.vout.push_back(out);
}

View File

@ -86,7 +86,7 @@ private:
MergeToAddressRecipient recipient_;
bool isToTaddr_;
bool isToZaddr_;
CBitcoinAddress toTaddr_;
CTxDestination toTaddr_;
PaymentAddress toPaymentAddress_;
uint256 joinSplitPubKey_;

View File

@ -10,7 +10,7 @@
#include <init.h>
#include <net.h>
#include <netbase.h>
#include <rpcserver.h>
#include <rpc/server.h>
#include <timedata.h>
#include <util.h>
#include <utilmoneystr.h>
@ -19,7 +19,7 @@
#include <script/interpreter.h>
#include <utiltime.h>
#include <validation.h>
#include <rpcprotocol.h>
#include <rpc/protocol.h>
#include <zcash/IncrementalMerkleTree.hpp>
#include <sodium.h>
#include <miner.h>
@ -29,7 +29,7 @@
#include <thread>
#include <string>
#include <wallet/paymentdisclosuredb.h>
#include <paymentdisclosuredb.h>
using namespace libzcash;
@ -74,7 +74,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
throw JSONRPCError(RPC_INVALID_PARAMETER, "No recipients");
}
fromtaddr_ = CBitcoinAddress(fromAddress);
fromtaddr_ = DecodeDestination(fromAddress);
isfromtaddr_ = fromtaddr_.IsValid();
isfromzaddr_ = false;
@ -829,7 +829,7 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) {
set<CBitcoinAddress> setAddress = {fromtaddr_};
set<CTxDestination> setAddress = {fromtaddr_};
vector<COutput> vecOutputs;
LOCK2(cs_main, pwalletMain->cs_wallet);
@ -902,7 +902,7 @@ bool AsyncRPCOperation_sendmany::find_unspent_notes() {
// sort in descending order, so big notes appear first
std::sort(z_inputs_.begin(), z_inputs_.end(), [](SendManyInputJSOP i, SendManyInputJSOP j) -> bool {
return ( std::get<2>(i) > std::get<2>(j));
return (std::get<2>(i) > std::get<2>(j));
});
return true;
@ -1101,12 +1101,12 @@ void AsyncRPCOperation_sendmany::add_taddr_outputs_to_tx() {
std::string outputAddress = std::get<0>(r);
CAmount nAmount = std::get<1>(r);
CBitcoinAddress address(outputAddress);
if (!address.IsValid()) {
CTxDestination address = DecodeDestination(outputAddress);
if (!IsValidDestination(address)) {
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);
rawTx.vout.push_back(out);

View File

@ -79,7 +79,7 @@ private:
std::string fromaddress_;
bool isfromtaddr_;
bool isfromzaddr_;
CBitcoinAddress fromtaddr_;
CTxDestination fromtaddr_;
PaymentAddress frompaymentaddress_;
SpendingKey spendingkey_;