Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,798 Lines • ▼ Show 20 Lines | if (!DecodeHexTx(mtx, request.params[0].get_str())) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); | ||||
} | } | ||||
// Sign the transaction | // Sign the transaction | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
EnsureWalletIsUnlocked(pwallet); | EnsureWalletIsUnlocked(pwallet); | ||||
return SignTransaction(pwallet->chain(), mtx, request.params[1], pwallet, | // Fetch previous transactions (inputs): | ||||
false, request.params[2]); | std::map<COutPoint, Coin> coins; | ||||
for (const CTxIn &txin : mtx.vin) { | |||||
// Create empty map entry keyed by prevout. | |||||
coins[txin.prevout]; | |||||
} | |||||
pwallet->chain().findCoins(coins); | |||||
return SignTransaction(mtx, request.params[1], pwallet, coins, false, | |||||
request.params[2]); | |||||
} | } | ||||
UniValue generate(const Config &config, const JSONRPCRequest &request) { | UniValue generate(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)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
▲ Show 20 Lines • Show All 990 Lines • Show Last 20 Lines |