From 3b11420b3c91f731b03805a39e48ee32e54484a2 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Jul 2019 18:34:18 +0100 Subject: [PATCH 1/2] [RPC] add new utxoupdatepsbt arguments to the CRPCCommand and CPRCConvertParam tables The new `descriptors` argument needs to be added to the Command and ConvertParams tables to by usable as a named argument and by bitcoin-cli. Also update the test to use named arguments to test this. --- src/rpc/client.cpp | 1 + src/rpc/rawtransaction.cpp | 2 +- test/functional/rpc_psbt.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 8f6bdc21aa7..3cd661e067d 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -28,6 +28,7 @@ public: static const CRPCConvertParam vRPCConvertParams[] = { { "setmocktime", 0, "timestamp" }, + { "utxoupdatepsbt", 1, "descriptors" }, { "generatetoaddress", 0, "nblocks" }, { "generatetoaddress", 2, "maxtries" }, { "getnetworkhashps", 0, "nblocks" }, diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 966ff3fedca..6ac16622c2b 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1776,7 +1776,7 @@ static const CRPCCommand commands[] = { "rawtransactions", "finalizepsbt", &finalizepsbt, {"psbt", "extract"} }, { "rawtransactions", "createpsbt", &createpsbt, {"inputs","outputs","locktime","replaceable"} }, { "rawtransactions", "converttopsbt", &converttopsbt, {"hexstring","permitsigdata","iswitness"} }, - { "rawtransactions", "utxoupdatepsbt", &utxoupdatepsbt, {"psbt"} }, + { "rawtransactions", "utxoupdatepsbt", &utxoupdatepsbt, {"psbt", "descriptors"} }, { "rawtransactions", "joinpsbts", &joinpsbts, {"txs"} }, { "rawtransactions", "analyzepsbt", &analyzepsbt, {"psbt"} }, diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index 2fffe96ebe7..dc113da5306 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -346,7 +346,7 @@ class PSBTTest(BitcoinTestFramework): # Try again, now while providing descriptors, making P2SH-segwit work, and causing bip32_derivs and redeem_script to be filled in descs = [self.nodes[1].getaddressinfo(addr)['desc'] for addr in [addr1,addr2,addr3]] - updated = self.nodes[1].utxoupdatepsbt(psbt, descs) + updated = self.nodes[1].utxoupdatepsbt(psbt=psbt, descriptors=descs) decoded = self.nodes[1].decodepsbt(updated) test_psbt_input_keys(decoded['inputs'][0], ['witness_utxo', 'bip32_derivs']) test_psbt_input_keys(decoded['inputs'][1], []) From 91cc18f602fe2ff7fe47335a8e1e7734895a19d9 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 4 Jul 2019 08:06:03 -0400 Subject: [PATCH 2/2] [docs] Add release notes for PR 15427 --- doc/release-notes-15427.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/release-notes-15427.md diff --git a/doc/release-notes-15427.md b/doc/release-notes-15427.md new file mode 100644 index 00000000000..25edfd44028 --- /dev/null +++ b/doc/release-notes-15427.md @@ -0,0 +1,9 @@ +Updated RPCs +------------ + +The `utxoupdatepsbt` RPC method has been updated to take a `descriptors` +argument. When provided, input and output scripts and keys will be filled in +when known, and P2SH-witness inputs will be filled in from the UTXO set when a +descriptor is provided that shows they're spending segwit outputs. + +See the RPC help text for full details.