MCPcopy Create free account
hub / github.com/ElementsProject/elements / removeprunedfunds

Function removeprunedfunds

src/wallet/rpc/backup.cpp:376–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376RPCHelpMan removeprunedfunds()
377{
378 return RPCHelpMan{"removeprunedfunds",
379 "\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n",
380 {
381 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded id of the transaction you are deleting"},
382 },
383 RPCResult{RPCResult::Type::NONE, "", ""},
384 RPCExamples{
385 HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") +
386 "\nAs a JSON-RPC call\n"
387 + HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"")
388 },
389 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
390{
391 std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
392 if (!pwallet) return NullUniValue;
393
394 LOCK(pwallet->cs_wallet);
395
396 uint256 hash(ParseHashV(request.params[0], "txid"));
397 std::vector<uint256> vHash;
398 vHash.push_back(hash);
399 std::vector<uint256> vHashOut;
400
401 if (pwallet->ZapSelectTx(vHash, vHashOut) != DBErrors::LOAD_OK) {
402 throw JSONRPCError(RPC_WALLET_ERROR, "Could not properly delete the transaction.");
403 }
404
405 if(vHashOut.empty()) {
406 throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction does not exist in wallet.");
407 }
408
409 return NullUniValue;
410},
411 };
412}
413
414RPCHelpMan importpubkey()
415{

Callers

nothing calls this directly

Calls 8

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ParseHashVFunction · 0.85
JSONRPCErrorFunction · 0.85
push_backMethod · 0.45
ZapSelectTxMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected