Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show All 21 Lines | |||||
#include <util/error.h> | #include <util/error.h> | ||||
#include <util/message.h> // For MessageSign() | #include <util/message.h> // For MessageSign() | ||||
#include <util/moneystr.h> | #include <util/moneystr.h> | ||||
#include <util/string.h> | #include <util/string.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#include <util/url.h> | #include <util/url.h> | ||||
#include <wallet/coincontrol.h> | #include <wallet/coincontrol.h> | ||||
#include <wallet/psbtwallet.h> | |||||
#include <wallet/rpcwallet.h> | #include <wallet/rpcwallet.h> | ||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
#include <wallet/walletdb.h> | #include <wallet/walletdb.h> | ||||
#include <wallet/walletutil.h> | #include <wallet/walletutil.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <event2/http.h> | #include <event2/http.h> | ||||
▲ Show 20 Lines • Show All 4,531 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() ? true : request.params[3].get_bool(); | request.params[3].isNull() ? true : request.params[3].get_bool(); | ||||
bool complete = true; | bool complete = true; | ||||
const TransactionError err = | const TransactionError err = | ||||
FillPSBT(pwallet, psbtx, complete, nHashType, sign, bip32derivs); | pwallet->FillPSBT(psbtx, complete, nHashType, sign, bip32derivs); | ||||
if (err != TransactionError::OK) { | 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())); | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | static UniValue walletcreatefundedpsbt(const Config &config, | ||||
// Make a blank psbt | // Make a blank psbt | ||||
PartiallySignedTransaction psbtx(rawTx); | PartiallySignedTransaction psbtx(rawTx); | ||||
// 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() ? true : request.params[4].get_bool(); | request.params[4].isNull() ? true : request.params[4].get_bool(); | ||||
bool complete = true; | bool complete = true; | ||||
const TransactionError err = | const TransactionError err = pwallet->FillPSBT( | ||||
FillPSBT(pwallet, psbtx, complete, SigHashType().withForkId(), false, | psbtx, complete, SigHashType().withForkId(), false, bip32derivs); | ||||
bip32derivs); | |||||
if (err != TransactionError::OK) { | 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; | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |