Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show All 17 Lines | |||||
#include <policy/fees.h> | #include <policy/fees.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <rpc/mining.h> | #include <rpc/mining.h> | ||||
#include <rpc/rawtransaction_util.h> | #include <rpc/rawtransaction_util.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#include <shutdown.h> | #include <shutdown.h> | ||||
#include <timedata.h> | #include <timedata.h> | ||||
#include <util/error.h> | |||||
#include <util/moneystr.h> | #include <util/moneystr.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/url.h> | #include <util/url.h> | ||||
#include <util/validation.h> | #include <util/validation.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <wallet/coincontrol.h> | #include <wallet/coincontrol.h> | ||||
#include <wallet/psbtwallet.h> | #include <wallet/psbtwallet.h> | ||||
#include <wallet/rpcwallet.h> | #include <wallet/rpcwallet.h> | ||||
▲ Show 20 Lines • Show All 4,574 Lines • ▼ Show 20 Lines | static UniValue walletprocesspsbt(const Config &config, | ||||
} | } | ||||
// Fill transaction with our data and also sign | // Fill transaction with our data and also sign | ||||
bool sign = | bool sign = | ||||
request.params[1].isNull() ? true : request.params[1].get_bool(); | request.params[1].isNull() ? true : request.params[1].get_bool(); | ||||
bool bip32derivs = | bool bip32derivs = | ||||
request.params[3].isNull() ? false : request.params[3].get_bool(); | request.params[3].isNull() ? false : request.params[3].get_bool(); | ||||
bool complete = true; | bool complete = true; | ||||
TransactionError err; | const TransactionError err = | ||||
if (!FillPSBT(pwallet, psbtx, err, complete, nHashType, sign, | FillPSBT(pwallet, psbtx, complete, nHashType, sign, bip32derivs); | ||||
bip32derivs)) { | if (err != TransactionError::OK) { | ||||
throw JSONRPCTransactionError(err); | throw JSONRPCTransactionError(err); | ||||
} | } | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); | CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); | ||||
ssTx << psbtx; | ssTx << psbtx; | ||||
result.pushKV("psbt", EncodeBase64(ssTx.str())); | result.pushKV("psbt", EncodeBase64(ssTx.str())); | ||||
result.pushKV("complete", complete); | result.pushKV("complete", complete); | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | static UniValue walletcreatefundedpsbt(const Config &config, | ||||
// Make a blank psbt | // Make a blank psbt | ||||
const CTransaction tx = CTransaction(rawTx); | const CTransaction tx = CTransaction(rawTx); | ||||
PartiallySignedTransaction psbtx(tx); | PartiallySignedTransaction psbtx(tx); | ||||
// Fill transaction with out data but don't sign | // Fill transaction with out data but don't sign | ||||
bool bip32derivs = | bool bip32derivs = | ||||
request.params[4].isNull() ? false : request.params[4].get_bool(); | request.params[4].isNull() ? false : request.params[4].get_bool(); | ||||
bool complete = true; | bool complete = true; | ||||
TransactionError err; | const TransactionError err = | ||||
if (!FillPSBT(pwallet, psbtx, err, complete, SigHashType().withForkId(), | FillPSBT(pwallet, psbtx, complete, SigHashType().withForkId(), false, | ||||
false, bip32derivs)) { | bip32derivs); | ||||
if (err != TransactionError::OK) { | |||||
throw JSONRPCTransactionError(err); | throw JSONRPCTransactionError(err); | ||||
} | } | ||||
// Serialize the PSBT | // Serialize the PSBT | ||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); | CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); | ||||
ssTx << psbtx; | ssTx << psbtx; | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |