| 4600 | } |
| 4601 | |
| 4602 | UniValue walletprocesspsbt(const JSONRPCRequest& request) |
| 4603 | { |
| 4604 | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); |
| 4605 | CWallet* const pwallet = wallet.get(); |
| 4606 | |
| 4607 | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { |
| 4608 | return NullUniValue; |
| 4609 | } |
| 4610 | |
| 4611 | if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) |
| 4612 | throw std::runtime_error( |
| 4613 | "walletprocesspsbt \"psbt\" ( sign \"sighashtype\" bip32derivs )\n" |
| 4614 | "\nUpdate a PSBT with input information from our wallet and then sign inputs\n" |
| 4615 | "that we can sign for.\n" |
| 4616 | + HelpRequiringPassphrase(pwallet) + "\n" |
| 4617 | |
| 4618 | "\nArguments:\n" |
| 4619 | "1. \"psbt\" (string, required) The transaction base64 string\n" |
| 4620 | "2. sign (boolean, optional, default=true) Also sign the transaction when updating\n" |
| 4621 | "3. \"sighashtype\" (string, optional, default=ALL) The signature hash type to sign with if not specified by the PSBT. Must be one of\n" |
| 4622 | " \"ALL\"\n" |
| 4623 | " \"NONE\"\n" |
| 4624 | " \"SINGLE\"\n" |
| 4625 | " \"ALL|ANYONECANPAY\"\n" |
| 4626 | " \"ALL|FORKID\"\n" |
| 4627 | " \"ALL|FORKID|ANYONECANPAY\"\n" |
| 4628 | " \"NONE|ANYONECANPAY\"\n" |
| 4629 | " \"NONE|FORKID\"\n" |
| 4630 | " \"NONE|FORKID|ANYONECANPAY\"\n" |
| 4631 | " \"SINGLE|ANYONECANPAY\"\n" |
| 4632 | " \"SINGLE|FORKID\"\n" |
| 4633 | " \"SINGLE|FORKID|ANYONECANPAY\"\n" |
| 4634 | "4. bip32derivs (boolean, optional, default=false) If true, includes the BIP 32 derivation paths for public keys if we know them\n" |
| 4635 | |
| 4636 | "\nResult:\n" |
| 4637 | "{\n" |
| 4638 | " \"psbt\" : \"value\", (string) The base64-encoded partially signed transaction\n" |
| 4639 | " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n" |
| 4640 | " ]\n" |
| 4641 | "}\n" |
| 4642 | |
| 4643 | "\nExamples:\n" |
| 4644 | + HelpExampleCli("walletprocesspsbt", "\"psbt\"") |
| 4645 | ); |
| 4646 | |
| 4647 | RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VSTR}); |
| 4648 | |
| 4649 | // Unserialize the transaction |
| 4650 | PartiallySignedTransaction psbtx; |
| 4651 | std::string error; |
| 4652 | if (!DecodePSBT(psbtx, request.params[0].get_str(), error)) { |
| 4653 | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed %s", error)); |
| 4654 | } |
| 4655 | |
| 4656 | bool no_forkid; |
| 4657 | { |
| 4658 | LOCK(cs_main); |
| 4659 | no_forkid = !IsBTGHardForkEnabledForCurrentBlock(Params().GetConsensus()); |
nothing calls this directly
no test coverage detected