Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 2,121 Lines • ▼ Show 20 Lines | static UniValue gettransaction(const Config &config, | ||||
WalletTxToJSON(pwallet->chain(), *locked_chain, wtx, entry); | WalletTxToJSON(pwallet->chain(), *locked_chain, wtx, entry); | ||||
UniValue details(UniValue::VARR); | UniValue details(UniValue::VARR); | ||||
ListTransactions(*locked_chain, pwallet, wtx, 0, false, details, filter, | ListTransactions(*locked_chain, pwallet, wtx, 0, false, details, filter, | ||||
nullptr /* filter_label */); | nullptr /* filter_label */); | ||||
entry.pushKV("details", details); | entry.pushKV("details", details); | ||||
std::string strHex = EncodeHexTx(*wtx.tx, RPCSerializationFlags()); | std::string strHex = | ||||
EncodeHexTx(*wtx.tx, pwallet->chain().rpcSerializationFlags()); | |||||
entry.pushKV("hex", strHex); | entry.pushKV("hex", strHex); | ||||
return entry; | return entry; | ||||
} | } | ||||
static UniValue abandontransaction(const Config &config, | static UniValue abandontransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | static UniValue walletpassphrase(const Config &config, | ||||
pwallet->TopUpKeyPool(); | pwallet->TopUpKeyPool(); | ||||
pwallet->nRelockTime = GetTime() + nSleepTime; | pwallet->nRelockTime = GetTime() + nSleepTime; | ||||
// Keep a weak pointer to the wallet so that it is possible to unload the | // Keep a weak pointer to the wallet so that it is possible to unload the | ||||
// wallet before the following callback is called. If a valid shared pointer | // wallet before the following callback is called. If a valid shared pointer | ||||
// is acquired in the callback then the wallet is still loaded. | // is acquired in the callback then the wallet is still loaded. | ||||
std::weak_ptr<CWallet> weak_wallet = wallet; | std::weak_ptr<CWallet> weak_wallet = wallet; | ||||
RPCRunLater( | pwallet->chain().rpcRunLater( | ||||
strprintf("lockwallet(%s)", pwallet->GetName()), | strprintf("lockwallet(%s)", pwallet->GetName()), | ||||
[weak_wallet] { | [weak_wallet] { | ||||
if (auto shared_wallet = weak_wallet.lock()) { | if (auto shared_wallet = weak_wallet.lock()) { | ||||
LOCK(shared_wallet->cs_wallet); | LOCK(shared_wallet->cs_wallet); | ||||
shared_wallet->Lock(); | shared_wallet->Lock(); | ||||
shared_wallet->nRelockTime = 0; | shared_wallet->nRelockTime = 0; | ||||
} | } | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 2,415 Lines • Show Last 20 Lines |