| 374 | } |
| 375 | |
| 376 | RPCHelpMan 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 | |
| 414 | RPCHelpMan importpubkey() |
| 415 | { |
nothing calls this directly
no test coverage detected