wallet, rpc: Remove watchonly from RPCs
Descriptor wallets don't have a conception of watchonly within a wallet, so remove all of these options and results from the RPCs
This commit is contained in:
1 parent
e81d95d435
commit
1337c72198
14 files changed
+135
-242
No files matched your search
@@ -42,7 +42,7 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
arg_conf_target=None, arg_estimate_mode=None, arg_fee_rate=None,
|
||||
conf_target=None, estimate_mode=None, fee_rate=None, add_to_wallet=None, psbt=None,
|
||||
inputs=None, add_inputs=None, include_unsafe=None, change_address=None, change_position=None, change_type=None,
|
||||
include_watching=None, locktime=None, lock_unspents=None, replaceable=None, subtract_fee_from_outputs=None,
|
||||
locktime=None, lock_unspents=None, replaceable=None, subtract_fee_from_outputs=None,
|
||||
expect_error=None, solving_data=None, minconf=None):
|
||||
assert_not_equal((amount is None), (data is None))
|
||||
|
||||
@@ -90,8 +90,6 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
options["change_position"] = change_position
|
||||
if change_type is not None:
|
||||
options["change_type"] = change_type
|
||||
if include_watching is not None:
|
||||
options["include_watching"] = include_watching
|
||||
if locktime is not None:
|
||||
options["locktime"] = locktime
|
||||
if lock_unspents is not None:
|
||||
@@ -110,6 +108,11 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
if len(options.keys()) == 0:
|
||||
options = None
|
||||
|
||||
expect_sign = from_wallet.getwalletinfo()["private_keys_enabled"]
|
||||
expect_sign = expect_sign and solving_data is None
|
||||
if inputs is not None:
|
||||
expect_sign = expect_sign and all(["weight" not in i for i in inputs])
|
||||
|
||||
if expect_error is None:
|
||||
res = from_wallet.send(outputs=outputs, conf_target=arg_conf_target, estimate_mode=arg_estimate_mode, fee_rate=arg_fee_rate, options=options)
|
||||
else:
|
||||
@@ -142,7 +145,7 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
if locktime:
|
||||
return res
|
||||
|
||||
if from_wallet.getwalletinfo()["private_keys_enabled"] and not include_watching:
|
||||
if expect_sign:
|
||||
assert_equal(res["complete"], True)
|
||||
assert "txid" in res
|
||||
else:
|
||||
@@ -154,7 +157,7 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
if include_unsafe:
|
||||
from_balance += from_wallet.getbalances()["mine"]["untrusted_pending"]
|
||||
|
||||
if add_to_wallet and not include_watching:
|
||||
if add_to_wallet:
|
||||
# Ensure transaction exists in the wallet:
|
||||
tx = from_wallet.gettransaction(res["txid"])
|
||||
assert tx
|
||||
@@ -215,17 +218,13 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
"desc": descsum_create("wpkh(" + xpub + "/0/0/*)"),
|
||||
"timestamp": "now",
|
||||
"range": [0, 100],
|
||||
"keypool": True,
|
||||
"active": True,
|
||||
"watchonly": True
|
||||
},{
|
||||
"desc": descsum_create("wpkh(" + xpub + "/0/1/*)"),
|
||||
"timestamp": "now",
|
||||
"range": [0, 100],
|
||||
"keypool": True,
|
||||
"active": True,
|
||||
"internal": True,
|
||||
"watchonly": True
|
||||
}])
|
||||
assert_equal(res, [{"success": True}, {"success": True}])
|
||||
|
||||
@@ -469,15 +468,15 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
ext_utxo = ext_fund.listunspent(addresses=[addr])[0]
|
||||
|
||||
# An external input without solving data should result in an error
|
||||
self.test_send(from_wallet=ext_wallet, to_wallet=self.nodes[0], amount=15, inputs=[ext_utxo], add_inputs=True, psbt=True, include_watching=True, expect_error=(-4, "Not solvable pre-selected input COutPoint(%s, %s)" % (ext_utxo["txid"][0:10], ext_utxo["vout"])))
|
||||
self.test_send(from_wallet=ext_wallet, to_wallet=self.nodes[0], amount=15, inputs=[ext_utxo], add_inputs=True, psbt=True, expect_error=(-4, "Not solvable pre-selected input COutPoint(%s, %s)" % (ext_utxo["txid"][0:10], ext_utxo["vout"])))
|
||||
|
||||
# But funding should work when the solving data is provided
|
||||
res = self.test_send(from_wallet=ext_wallet, to_wallet=self.nodes[0], amount=15, inputs=[ext_utxo], add_inputs=True, psbt=True, include_watching=True, solving_data={"pubkeys": [addr_info['pubkey']], "scripts": [addr_info["embedded"]["scriptPubKey"], addr_info["embedded"]["embedded"]["scriptPubKey"]]})
|
||||
res = self.test_send(from_wallet=ext_wallet, to_wallet=self.nodes[0], amount=15, inputs=[ext_utxo], add_inputs=True, psbt=True, solving_data={"pubkeys": [addr_info['pubkey']], "scripts": [addr_info["embedded"]["scriptPubKey"], addr_info["embedded"]["embedded"]["scriptPubKey"]]})
|
||||
signed = ext_wallet.walletprocesspsbt(res["psbt"])
|
||||
signed = ext_fund.walletprocesspsbt(res["psbt"])
|
||||
assert signed["complete"]
|
||||
|
||||
res = self.test_send(from_wallet=ext_wallet, to_wallet=self.nodes[0], amount=15, inputs=[ext_utxo], add_inputs=True, psbt=True, include_watching=True, solving_data={"descriptors": [desc]})
|
||||
res = self.test_send(from_wallet=ext_wallet, to_wallet=self.nodes[0], amount=15, inputs=[ext_utxo], add_inputs=True, psbt=True, solving_data={"descriptors": [desc]})
|
||||
signed = ext_wallet.walletprocesspsbt(res["psbt"])
|
||||
signed = ext_fund.walletprocesspsbt(res["psbt"])
|
||||
assert signed["complete"]
|
||||
@@ -510,7 +509,6 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
inputs=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": input_weight}],
|
||||
add_inputs=True,
|
||||
psbt=True,
|
||||
include_watching=True,
|
||||
fee_rate=target_fee_rate_sat_vb
|
||||
)
|
||||
signed = ext_wallet.walletprocesspsbt(res["psbt"])
|
||||
|
||||
Reference in new issue
Block a user