mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
wallet: Add missing BlockUntilSyncedToCurrentChain
This commit is contained in:
parent
672870ab7b
commit
fadb55085a
1 changed files with 14 additions and 4 deletions
|
@ -4317,6 +4317,11 @@ static RPCHelpMan walletprocesspsbt()
|
||||||
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
|
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
|
||||||
if (!pwallet) return NullUniValue;
|
if (!pwallet) return NullUniValue;
|
||||||
|
|
||||||
|
const CWallet& wallet{*pwallet};
|
||||||
|
// Make sure the results are valid at least up to the most recent block
|
||||||
|
// the user could have gotten from another RPC command prior to now
|
||||||
|
wallet.BlockUntilSyncedToCurrentChain();
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VSTR});
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VSTR});
|
||||||
|
|
||||||
// Unserialize the transaction
|
// Unserialize the transaction
|
||||||
|
@ -4333,7 +4338,7 @@ static RPCHelpMan walletprocesspsbt()
|
||||||
bool sign = request.params[1].isNull() ? true : request.params[1].get_bool();
|
bool sign = request.params[1].isNull() ? true : request.params[1].get_bool();
|
||||||
bool bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool();
|
bool bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool();
|
||||||
bool complete = true;
|
bool complete = true;
|
||||||
const TransactionError err = pwallet->FillPSBT(psbtx, complete, nHashType, sign, bip32derivs);
|
const TransactionError err{wallet.FillPSBT(psbtx, complete, nHashType, sign, bip32derivs)};
|
||||||
if (err != TransactionError::OK) {
|
if (err != TransactionError::OK) {
|
||||||
throw JSONRPCTransactionError(err);
|
throw JSONRPCTransactionError(err);
|
||||||
}
|
}
|
||||||
|
@ -4431,6 +4436,11 @@ static RPCHelpMan walletcreatefundedpsbt()
|
||||||
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
|
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
|
||||||
if (!pwallet) return NullUniValue;
|
if (!pwallet) return NullUniValue;
|
||||||
|
|
||||||
|
CWallet& wallet{*pwallet};
|
||||||
|
// Make sure the results are valid at least up to the most recent block
|
||||||
|
// the user could have gotten from another RPC command prior to now
|
||||||
|
wallet.BlockUntilSyncedToCurrentChain();
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {
|
RPCTypeCheck(request.params, {
|
||||||
UniValue::VARR,
|
UniValue::VARR,
|
||||||
UniValueType(), // ARR or OBJ, checked later
|
UniValueType(), // ARR or OBJ, checked later
|
||||||
|
@ -4442,7 +4452,7 @@ static RPCHelpMan walletcreatefundedpsbt()
|
||||||
|
|
||||||
CAmount fee;
|
CAmount fee;
|
||||||
int change_position;
|
int change_position;
|
||||||
bool rbf = pwallet->m_signal_rbf;
|
bool rbf{wallet.m_signal_rbf};
|
||||||
const UniValue &replaceable_arg = request.params[3]["replaceable"];
|
const UniValue &replaceable_arg = request.params[3]["replaceable"];
|
||||||
if (!replaceable_arg.isNull()) {
|
if (!replaceable_arg.isNull()) {
|
||||||
RPCTypeCheckArgument(replaceable_arg, UniValue::VBOOL);
|
RPCTypeCheckArgument(replaceable_arg, UniValue::VBOOL);
|
||||||
|
@ -4453,7 +4463,7 @@ static RPCHelpMan walletcreatefundedpsbt()
|
||||||
// Automatically select coins, unless at least one is manually selected. Can
|
// Automatically select coins, unless at least one is manually selected. Can
|
||||||
// be overridden by options.add_inputs.
|
// be overridden by options.add_inputs.
|
||||||
coin_control.m_add_inputs = rawTx.vin.size() == 0;
|
coin_control.m_add_inputs = rawTx.vin.size() == 0;
|
||||||
FundTransaction(*pwallet, rawTx, fee, change_position, request.params[3], coin_control, /* override_min_fee */ true);
|
FundTransaction(wallet, rawTx, fee, change_position, request.params[3], coin_control, /* override_min_fee */ true);
|
||||||
|
|
||||||
// Make a blank psbt
|
// Make a blank psbt
|
||||||
PartiallySignedTransaction psbtx(rawTx);
|
PartiallySignedTransaction psbtx(rawTx);
|
||||||
|
@ -4461,7 +4471,7 @@ static RPCHelpMan walletcreatefundedpsbt()
|
||||||
// Fill transaction with out data but don't sign
|
// Fill transaction with out data but don't sign
|
||||||
bool bip32derivs = request.params[4].isNull() ? true : request.params[4].get_bool();
|
bool bip32derivs = request.params[4].isNull() ? true : request.params[4].get_bool();
|
||||||
bool complete = true;
|
bool complete = true;
|
||||||
const TransactionError err = pwallet->FillPSBT(psbtx, complete, 1, false, bip32derivs);
|
const TransactionError err{wallet.FillPSBT(psbtx, complete, 1, false, bip32derivs)};
|
||||||
if (err != TransactionError::OK) {
|
if (err != TransactionError::OK) {
|
||||||
throw JSONRPCTransactionError(err);
|
throw JSONRPCTransactionError(err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue