Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,880 Lines • ▼ Show 20 Lines | for (const CTxIn &txin : mtx.vin) { | ||||
// Create empty map entry keyed by prevout. | // Create empty map entry keyed by prevout. | ||||
coins[txin.prevout]; | coins[txin.prevout]; | ||||
} | } | ||||
pwallet->chain().findCoins(coins); | pwallet->chain().findCoins(coins); | ||||
// Parse the prevtxs array | // Parse the prevtxs array | ||||
ParsePrevouts(request.params[1], nullptr, coins); | ParsePrevouts(request.params[1], nullptr, coins); | ||||
std::set<std::shared_ptr<SigningProvider>> providers; | SigHashType nHashType = ParseSighashString(request.params[2]); | ||||
for (const std::pair<COutPoint, Coin> coin_pair : coins) { | if (!nHashType.hasForkId()) { | ||||
std::unique_ptr<SigningProvider> provider = pwallet->GetSigningProvider( | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
coin_pair.second.GetTxOut().scriptPubKey); | "Signature must use SIGHASH_FORKID"); | ||||
if (provider) { | |||||
providers.insert(std::move(provider)); | |||||
} | |||||
} | |||||
if (providers.size() == 0) { | |||||
// When there are no available providers, use a dummy SigningProvider so | |||||
// we can check if the tx is complete | |||||
providers.insert(std::make_shared<SigningProvider>()); | |||||
} | } | ||||
// Script verification errors | |||||
std::map<int, std::string> input_errors; | |||||
bool complete = | |||||
pwallet->SignTransaction(mtx, coins, nHashType, input_errors); | |||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
for (std::shared_ptr<SigningProvider> provider : providers) { | SignTransactionResultToJSON(mtx, complete, coins, input_errors, result); | ||||
SignTransaction(mtx, provider.get(), coins, request.params[2], result); | |||||
} | |||||
return result; | return result; | ||||
} | } | ||||
UniValue rescanblockchain(const Config &config, const JSONRPCRequest &request) { | UniValue rescanblockchain(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
▲ Show 20 Lines • Show All 964 Lines • Show Last 20 Lines |