mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-31 22:51:27 +02:00
rpc, psbt: Require sighashes match for descriptorprocesspsbt
This commit is contained in:
@@ -283,6 +283,9 @@ class PSBTTest(BitcoinTestFramework):
|
||||
def_wallet.sendtoaddress(addr, 5)
|
||||
self.generate(self.nodes[0], 6)
|
||||
|
||||
# Retrieve the descriptors so we can do all of the tests with descriptorprocesspsbt as well
|
||||
descs = wallet.listdescriptors(True)["descriptors"]
|
||||
|
||||
# Make a PSBT
|
||||
psbt = wallet.walletcreatefundedpsbt([], [{def_wallet.getnewaddress(): 1}])["psbt"]
|
||||
|
||||
@@ -299,6 +302,15 @@ class PSBTTest(BitcoinTestFramework):
|
||||
proc = wallet.walletprocesspsbt(psbt, True, "ALL|ANYONECANPAY")
|
||||
assert_equal(proc["complete"], True)
|
||||
|
||||
# Repeat with descriptorprocesspsbt
|
||||
# Mismatching sighash type fails, including when no type is specified
|
||||
for sighash in ["DEFAULT", "ALL", "NONE", "SINGLE", "NONE|ANYONECANPAY", "SINGLE|ANYONECANPAY", None]:
|
||||
assert_raises_rpc_error(-22, "Specified sighash value does not match value stored in PSBT", self.nodes[0].descriptorprocesspsbt, psbt, descs, sighash)
|
||||
|
||||
# Matching sighash type succeeds
|
||||
proc = self.nodes[0].descriptorprocesspsbt(psbt, descs, "ALL|ANYONECANPAY")
|
||||
assert_equal(proc["complete"], True)
|
||||
|
||||
wallet.unloadwallet()
|
||||
|
||||
def test_sighash_adding(self):
|
||||
|
Reference in New Issue
Block a user