Disable previously-deprecated features by default

These features were deprecated at least 3 minor releases ago. I found
one mistake which was that `z_validateaddress` had not been placed
behind the `addrtype` deprecated feature; this has been fixed.
This commit is contained in:
Jack Grigg 2022-12-03 05:49:43 +00:00
parent 37921677e9
commit 09cd65327b
72 changed files with 549 additions and 216 deletions

View File

@ -35,34 +35,24 @@ The following features are deprecated, but remain enabled by default. These feat
will be disabled if `-allowdeprecated=none` is added to the CLI arguments when starting
the node, or if an `allowdeprecated=none` line is added to `zcash.conf`.
### Deprecated in 5.0.0
The following features are deprecated as of release 5.0.0 and will be disabled by
default as of release 5.3.0.
- `legacy_privacy` - The default "legacy" privacy policy for z_sendmany is
deprecated. Use `-allowdeprecated=none` to require the default behavior to
conform to the `FullPrivacy` directive in all cases instead of just for
transactions involving unified addresses.
- `getnewaddress` - The `getnewaddress` RPC method is deprecated.
- `getrawchangeaddress` - The `getrawchangeaddress` RPC method is deprecated.
- `z_getbalance` - The `z_getbalance` RPC method is deprecated.
- `z_gettotalbalance` - The `z_gettotalbalance` RPC method is deprecated.
- `z_getnewaddress` - The `z_getnewaddress` RPC method is deprecated.
- `z_listaddresses` - The `z_listaddresses` RPC method is deprecated.
- `addrtype` - The `type` attribute is deprecated in the results of RPC
methods that return address metadata. It is recommended that applications
using this metadata be updated to use the `pool` or `address_type`
attributes, which have replaced the `type` attribute, as appropriate.
### Deprecated in 5.1.0
- `wallettxvjoinsplit` - The `vjoinsplit` attribute returned by the
`gettransaction` RPC method is deprecated.
| `feature` | Deprecated | Feature details
|-----------------------|------------|----------------
Stage 2
-------
Each feature in the lists below may be enabled by adding `-allowdeprecated=<feature>`
Each feature in the table below may be enabled by adding `-allowdeprecated=<feature>`
to the CLI arguments when starting the node, or by adding an `allowdeprecated=<feature>`
line to `zcash.conf`.
| `feature` | Deprecated | Feature details
|-----------------------|------------|----------------
| `legacy_privacy` | 5.0.0 | The default "legacy" privacy policy for `z_sendmany` has been replaced by the `FullPrivacy` directive.
| `getnewaddress` | 5.0.0 | The `getnewaddress` RPC method.
| `getrawchangeaddress` | 5.0.0 | The `getrawchangeaddress` RPC method.
| `z_getbalance` | 5.0.0 | The `z_getbalance` RPC method.
| `z_gettotalbalance` | 5.0.0 | The `z_gettotalbalance` RPC method.
| `z_getnewaddress` | 5.0.0 | The `z_getnewaddress` RPC method.
| `z_listaddresses` | 5.0.0 | The `z_listaddresses` RPC method.
| `addrtype` | 5.0.0 | The `type` attribute is deprecated in the results of RPC methods that return address metadata. It is recommended that applications using this metadata be updated to use the `pool` or `address_type` attributes, which have replaced the `type` attribute, as appropriate.
| `wallettxvjoinsplit` | 5.1.0 | The `vjoinsplit` attribute returned by the `gettransaction` RPC method.

View File

@ -17,6 +17,19 @@ RPC Changes
[Deprecations](https://zcash.github.io/zcash/user/deprecation.html)
--------------
The following previously-deprecated features have been disabled by default, and
will be removed in 18 weeks:
- `legacy_privacy`
- `getnewaddress`
- `getrawchangeaddress`
- `z_getbalance`
- `z_gettotalbalance`
- `z_getnewaddress`
- `z_listaddresses`
- `addrtype`
- `wallettxvjoinsplit`
The following previously-deprecated features have been removed:
- `dumpwallet`

View File

@ -49,10 +49,16 @@ class AddressIndexTest(BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_network(self):
base_args = [
'-debug',
'-txindex',
'-experimentalfeatures',
'-allowdeprecated=getnewaddress',
]
# -insightexplorer causes addressindex to be enabled (fAddressIndex = true)
args_insight = ('-debug', '-txindex', '-experimentalfeatures', '-insightexplorer')
args_insight = base_args + ['-insightexplorer']
# -lightwallet also causes addressindex to be enabled
args_lightwallet = ('-debug', '-txindex', '-experimentalfeatures', '-lightwalletd')
args_lightwallet = base_args + ['-lightwalletd']
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [args_insight] * 3 + [args_lightwallet])
connect_nodes(self.nodes[0], 1)

View File

@ -26,7 +26,11 @@ class BIP65Test(ComparisonTestFramework):
def setup_network(self):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1']],
extra_args=[[
'-debug',
'-whitelist=127.0.0.1',
'-allowdeprecated=getnewaddress',
]],
binary=[self.options.testbinary])
self.is_network_split = False

View File

@ -26,7 +26,11 @@ class BIP66Test(ComparisonTestFramework):
def setup_network(self):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1']],
extra_args=[[
'-debug',
'-whitelist=127.0.0.1',
'-allowdeprecated=getnewaddress',
]],
binary=[self.options.testbinary])
self.is_network_split = False

View File

@ -30,6 +30,9 @@ class CoinbaseFundingStreamsTest (BitcoinTestFramework):
nuparams(HEARTWOOD_BRANCH_ID, 2),
nuparams(CANOPY_BRANCH_ID, 5),
"-nurejectoldversions=false",
"-allowdeprecated=z_getnewaddress",
"-allowdeprecated=z_getbalance",
"-allowdeprecated=z_gettotalbalance",
]
return start_node(index, self.options.tmpdir, args + extra_args)

View File

@ -50,7 +50,9 @@ class Zip239Test(BitcoinTestFramework):
nuparams(HEARTWOOD_BRANCH_ID, 205),
nuparams(CANOPY_BRANCH_ID, 205),
nuparams(NU5_BRANCH_ID, 210),
"-preferredtxversion=5"
"-preferredtxversion=5",
"-allowdeprecated=getnewaddress",
"-allowdeprecated=z_getbalance",
]] * self.num_nodes)
def cinv_for(self, txid, authDigest=None):

View File

@ -37,6 +37,9 @@ class FinalOrchardRootTest(BitcoinTestFramework):
'-reindex', # Required due to enabling -txindex
nuparams(NU5_BRANCH_ID, 200),
'-debug',
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
self.is_network_split=False

View File

@ -37,6 +37,9 @@ class FinalSaplingRootTest(BitcoinTestFramework):
'-reindex', # Required due to enabling -txindex
nuparams(NU5_BRANCH_ID, 210),
'-debug',
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
self.is_network_split=False
@ -93,7 +96,7 @@ class FinalSaplingRootTest(BitcoinTestFramework):
saplingAddr0 = self.nodes[0].z_getnewaddress('sapling')
recipients = []
recipients.append({"address": saplingAddr0, "amount": Decimal('10')})
myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0, 'AllowRevealedSenders')
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
@ -193,7 +196,7 @@ class FinalSaplingRootTest(BitcoinTestFramework):
taddr2 = self.nodes[0].getnewaddress()
recipients = []
recipients.append({"address": taddr2, "amount": Decimal('2.34')})
myopid = self.nodes[1].z_sendmany(saplingAddr1, recipients, 1, 0)
myopid = self.nodes[1].z_sendmany(saplingAddr1, recipients, 1, 0, 'AllowRevealedRecipients')
mytxid = wait_and_assert_operationid_status(self.nodes[1], myopid)
self.sync_all()

View File

@ -21,8 +21,11 @@ class RawTransactionsTest(BitcoinTestFramework):
self.num_nodes = 4
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-experimentalfeatures', '-developerencryptwallet']] * 4)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-experimentalfeatures',
'-developerencryptwallet',
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
@ -450,7 +453,9 @@ class RawTransactionsTest(BitcoinTestFramework):
stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)

View File

@ -9,6 +9,7 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
CANOPY_BRANCH_ID,
DEFAULT_FEE,
NU5_BRANCH_ID,
get_coinbase_address,
hex_str_to_bytes,
@ -40,6 +41,8 @@ class GetBlockTemplateTest(BitcoinTestFramework):
args = [
nuparams(CANOPY_BRANCH_ID, 215),
nuparams(NU5_BRANCH_ID, 230),
"-allowdeprecated=getnewaddress",
"-allowdeprecated=z_getbalance",
]
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [args] * self.num_nodes)
self.is_network_split = False
@ -49,13 +52,13 @@ class GetBlockTemplateTest(BitcoinTestFramework):
node = self.node
# sprout to transparent (v4)
recipients = [{"address": self.transparent_addr, "amount": Decimal('0.1')}]
myopid = node.z_sendmany(self.sprout_addr, recipients, 1)
myopid = node.z_sendmany(self.sprout_addr, recipients, 1, DEFAULT_FEE, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(node, myopid)
def add_nu5_v5_tx_to_mempool(self):
node = self.node
recipients = [{"address": self.unified_addr, "amount": Decimal('9.99999')}]
myopid = node.z_sendmany(get_coinbase_address(node), recipients, 1, Decimal('0.00001'), 'AllowRevealedSenders')
myopid = node.z_sendmany(get_coinbase_address(node), recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(node, myopid)
def add_transparent_tx_to_mempool(self):

View File

@ -27,8 +27,13 @@ class GetrawtransactionTest(BitcoinTestFramework):
def setup_network(self):
# -insightexplorer causes spentindex to be enabled (fSpentIndex = true)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
[['-debug', '-txindex', '-experimentalfeatures', '-insightexplorer']] * self.num_nodes)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-debug',
'-txindex',
'-experimentalfeatures',
'-insightexplorer',
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)

View File

@ -22,7 +22,9 @@ class KeyImportExportTest (BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir )
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)

View File

@ -40,7 +40,10 @@ class KeyPoolTest(BitcoinTestFramework):
nodes[0].encryptwallet('test')
bitcoind_processes[0].wait()
# Restart node 0
nodes[0] = start_node(0, self.options.tmpdir)
nodes[0] = start_node(0, self.options.tmpdir, extra_args=[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=getrawchangeaddress',
])
# We can't create any external addresses, which don't use the keypool.
# We should get an error that we need to unlock the wallet.
try:

View File

@ -7,7 +7,7 @@
# Exercise the listtransactions API
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
from test_framework.util import assert_equal, start_nodes
from decimal import Decimal
@ -41,6 +41,11 @@ def check_array_result(object_array, to_match, expected):
class ListTransactionsTest(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
def run_test(self):
# Simple send, 0 to 1:
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)

View File

@ -17,15 +17,21 @@ from test_framework.util import (
from decimal import Decimal
from time import sleep
BASE_ARGS = [
'-debug=mempool',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_gettotalbalance',
]
# Test wallet behaviour with Sapling addresses
class MempoolLimit(BitcoinTestFramework):
def setup_nodes(self):
extra_args = [
["-debug=mempool", '-mempooltxcostlimit=8000'], # 2 transactions at min cost
["-debug=mempool", '-mempooltxcostlimit=8000'], # 2 transactions at min cost
["-debug=mempool", '-mempooltxcostlimit=8000'], # 2 transactions at min cost
BASE_ARGS + ['-mempooltxcostlimit=8000'], # 2 transactions at min cost
BASE_ARGS + ['-mempooltxcostlimit=8000'], # 2 transactions at min cost
BASE_ARGS + ['-mempooltxcostlimit=8000'], # 2 transactions at min cost
# Let node 3 hold one more transaction
["-debug=mempool", '-mempooltxcostlimit=12000'], # 3 transactions at min cost
BASE_ARGS + ['-mempooltxcostlimit=12000'], # 3 transactions at min cost
]
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
@ -63,16 +69,25 @@ class MempoolLimit(BitcoinTestFramework):
zaddr3 = self.nodes[0].z_getnewaddress('sapling')
print("Filling mempool...")
opid1 = self.nodes[1].z_sendmany(get_coinbase_address(self.nodes[1]), [{"address": zaddr1, "amount": Decimal('10.0') - DEFAULT_FEE}])
opid1 = self.nodes[1].z_sendmany(
get_coinbase_address(self.nodes[1]),
[{"address": zaddr1, "amount": Decimal('10.0') - DEFAULT_FEE}],
1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[1], opid1)
opid2 = self.nodes[2].z_sendmany(get_coinbase_address(self.nodes[2]), [{"address": zaddr2, "amount": Decimal('10.0') - DEFAULT_FEE}])
opid2 = self.nodes[2].z_sendmany(
get_coinbase_address(self.nodes[2]),
[{"address": zaddr2, "amount": Decimal('10.0') - DEFAULT_FEE}],
1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[2], opid2)
self.sync_all()
self.check_mempool_sizes(2)
print("Adding one more transaction...")
opid3 = self.nodes[3].z_sendmany(get_coinbase_address(self.nodes[3]), [{"address": zaddr3, "amount": Decimal('10.0') - DEFAULT_FEE}])
opid3 = self.nodes[3].z_sendmany(
get_coinbase_address(self.nodes[3]),
[{"address": zaddr3, "amount": Decimal('10.0') - DEFAULT_FEE}],
1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[3], opid3)
# The mempools are no longer guaranteed to be in a consistent state, so we cannot sync
sleep(5)

View File

@ -29,7 +29,13 @@ class MempoolUpgradeActivationTest(BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_network(self):
args = ["-checkmempool", "-debug=mempool", "-blockmaxsize=4000",
args = [
"-checkmempool",
"-debug=mempool",
"-blockmaxsize=4000",
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
nuparams(BLOSSOM_BRANCH_ID, 200),
nuparams(HEARTWOOD_BRANCH_ID, 210),
nuparams(CANOPY_BRANCH_ID, 220),
@ -55,7 +61,7 @@ class MempoolUpgradeActivationTest(BitcoinTestFramework):
node1_taddr = get_coinbase_address(self.nodes[1])
node0_zaddr = self.nodes[0].z_getnewaddress('sapling')
recipients = [{'address': node0_zaddr, 'amount': Decimal('10')}]
myopid = self.nodes[1].z_sendmany(node1_taddr, recipients, 1, 0)
myopid = self.nodes[1].z_sendmany(node1_taddr, recipients, 1, 0, 'AllowRevealedSenders')
print(wait_and_assert_operationid_status(self.nodes[1], myopid))
self.sync_all()
self.nodes[0].generate(1)

View File

@ -23,7 +23,11 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
alert_filename = None # Set by setup_network
def setup_network(self):
args = ["-checkmempool", "-debug=mempool"]
args = [
"-checkmempool",
"-debug=mempool",
"-allowdeprecated=getnewaddress",
]
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, args))
self.nodes.append(start_node(1, self.options.tmpdir, args))

View File

@ -24,7 +24,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
def setup_network(self):
# Just need one node for this test
args = ["-checkmempool", "-debug=mempool"]
args = ["-checkmempool", "-debug=mempool", "-allowdeprecated=getnewaddress"]
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, args))
self.is_network_split = False

View File

@ -29,7 +29,11 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
def setup_network(self):
# Just need one node for this test
args = ["-checkmempool", "-debug=mempool"]
args = [
"-checkmempool",
"-debug=mempool",
"-allowdeprecated=getnewaddress",
]
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, args))
self.is_network_split = False

View File

@ -24,7 +24,10 @@ class MempoolTxExpiryTest(BitcoinTestFramework):
return start_nodes(self.num_nodes, self.options.tmpdir,
[[
"-txexpirydelta=%d" % TX_EXPIRY_DELTA,
"-debug=mempool"
"-debug=mempool",
"-allowdeprecated=getnewaddress",
"-allowdeprecated=z_getnewaddress",
"-allowdeprecated=z_gettotalbalance",
]] * self.num_nodes)
# Test before, at, and after expiry block

View File

@ -42,14 +42,17 @@ class MergeToAddressHelper:
initialize_chain_clean(test.options.tmpdir, 4)
def setup_network(self, test, additional_args=[]):
args = ['-debug=zrpcunsafe']
args = [
'-debug=zrpcunsafe',
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]
args += additional_args
test.nodes = []
test.nodes.append(start_node(0, test.options.tmpdir, args))
test.nodes.append(start_node(1, test.options.tmpdir, args))
args2 = ['-debug=zrpcunsafe']
args2 += additional_args
test.nodes.append(start_node(2, test.options.tmpdir, args2))
test.nodes.append(start_node(2, test.options.tmpdir, args))
connect_nodes_bi(test.nodes, 0, 1)
connect_nodes_bi(test.nodes, 1, 2)
connect_nodes_bi(test.nodes, 0, 2)
@ -97,7 +100,7 @@ class MergeToAddressHelper:
{'address': mytaddr, 'amount': 10},
{'address': mytaddr2, 'amount': 10},
{'address': mytaddr3, 'amount': 10},
], 1, 0)
], 1, 0, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(test.nodes[0], result)
test.sync_all()
test.nodes[1].generate(1)

View File

@ -13,7 +13,13 @@ from mergetoaddress_helper import assert_mergetoaddress_exception
class MergeToAddressMixedNotes(BitcoinTestFramework):
def setup_nodes(self):
self.num_nodes = 4
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[['-anchorconfirmations=1']] * self.num_nodes)
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-anchorconfirmations=1',
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
]] * self.num_nodes)
def setup_chain(self):
print("Initializing test directory " + self.options.tmpdir)
@ -41,7 +47,7 @@ class MergeToAddressMixedNotes(BitcoinTestFramework):
assert_mergetoaddress_exception(
"Cannot send from both Sprout and Sapling addresses using z_mergetoaddress",
lambda: self.nodes[0].z_mergetoaddress(["ANY_SPROUT", "ANY_SAPLING"], t_addr))
opid = self.nodes[0].z_sendmany(coinbase_addr, [{"address": saplingAddr, "amount": Decimal('10')}], 1, 0)
opid = self.nodes[0].z_sendmany(coinbase_addr, [{"address": saplingAddr, "amount": Decimal('10')}], 1, 0, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], opid)
self.nodes[0].generate(1)
self.sync_all()

View File

@ -23,13 +23,17 @@ class MerkleBlockTest(BitcoinTestFramework):
self.num_nodes = 4
def setup_network(self):
base_args = [
"-debug",
"-allowdeprecated=getnewaddress",
]
self.nodes = []
# Nodes 0/1 are "wallet" nodes
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug"]))
self.nodes.append(start_node(0, self.options.tmpdir, base_args))
self.nodes.append(start_node(1, self.options.tmpdir, base_args))
# Nodes 2/3 are used for testing
self.nodes.append(start_node(2, self.options.tmpdir, ["-debug"]))
self.nodes.append(start_node(3, self.options.tmpdir, ["-debug", "-txindex"]))
self.nodes.append(start_node(2, self.options.tmpdir, base_args))
self.nodes.append(start_node(3, self.options.tmpdir, base_args + ["-txindex"]))
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)
connect_nodes(self.nodes[0], 3)

View File

@ -35,6 +35,10 @@ class ShieldCoinbaseTest (BitcoinTestFramework):
nuparams(CANOPY_BRANCH_ID, 20),
nuparams(NU5_BRANCH_ID, 20),
"-nurejectoldversions=false",
"-allowdeprecated=getnewaddress",
"-allowdeprecated=z_getnewaddress",
"-allowdeprecated=z_getbalance",
"-allowdeprecated=z_gettotalbalance",
]
return start_node(index, self.options.tmpdir, args + extra_args)
@ -111,7 +115,7 @@ class ShieldCoinbaseTest (BitcoinTestFramework):
recipients = []
recipients.append({"address": node0_zaddr, "amount": Decimal('2')})
recipients.append({"address": node0_taddr, "amount": Decimal('2')})
myopid = self.nodes[1].z_sendmany(node1_zaddr, recipients, 1, 0)
myopid = self.nodes[1].z_sendmany(node1_zaddr, recipients, 1, 0, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(self.nodes[1], myopid)
self.sync_all()
self.nodes[0].generate(1)

View File

@ -20,7 +20,9 @@ class TxExpiringSoonTest(BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_network(self):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes, 0, 1)
# We don't connect node 2

View File

@ -20,7 +20,9 @@ class TxExpiryDoSTest(BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_network(self):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
def run_test(self):
test_node = TestNode()

View File

@ -26,8 +26,16 @@ class PrioritiseTransactionTest (BitcoinTestFramework):
def setup_network(self, split=False):
self.nodes = []
# Start nodes with tiny block size of 11kb
self.nodes.append(start_node(0, self.options.tmpdir, ["-blockprioritysize=7000", "-blockmaxsize=11000", "-maxorphantx=1000", "-relaypriority=true", "-printpriority=1"]))
self.nodes.append(start_node(1, self.options.tmpdir, ["-blockprioritysize=7000", "-blockmaxsize=11000", "-maxorphantx=1000", "-relaypriority=true", "-printpriority=1"]))
args = [
"-blockprioritysize=7000",
"-blockmaxsize=11000",
"-maxorphantx=1000",
"-relaypriority=true",
"-printpriority=1",
"-allowdeprecated=getnewaddress",
]
self.nodes.append(start_node(0, self.options.tmpdir, args))
self.nodes.append(start_node(1, self.options.tmpdir, args))
connect_nodes(self.nodes[1], 0)
self.is_network_split=False
self.sync_all()

View File

@ -25,7 +25,9 @@ class RawTransactionsTest(BitcoinTestFramework):
self.num_nodes = 3
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
#connect to a local machine for debugging
#url = "http://bitcoinrpc:DP6DvqZtqXarpeNWyN3LZTFchCCyCUuHwNF7E8pX99x1@%s:%d" % ('127.0.0.1', 18232)

View File

@ -4,10 +4,20 @@
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import wait_and_assert_operationid_status
from test_framework.util import (
DEFAULT_FEE,
start_nodes,
wait_and_assert_operationid_status,
)
class RegtestSignrawtransactionTest (BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]] * self.num_nodes)
def run_test(self):
self.nodes[0].generate(1)
self.sync_all()
@ -20,7 +30,10 @@ class RegtestSignrawtransactionTest (BitcoinTestFramework):
# Create and sign Sapling transaction.
# If the incorrect consensus branch id is selected, there will be a signing error.
opid = self.nodes[1].z_sendmany(taddr, [{'address': zaddr1, 'amount': 1}], 1)
opid = self.nodes[1].z_sendmany(
taddr,
[{'address': zaddr1, 'amount': 1}],
1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[1], opid)
if __name__ == '__main__':

View File

@ -27,6 +27,9 @@ HAS_CANOPY = [
nuparams(HEARTWOOD_BRANCH_ID, 210),
nuparams(CANOPY_BRANCH_ID, 220),
nuparams(NU5_BRANCH_ID, 225),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]
class RemoveSproutShieldingTest (BitcoinTestFramework):
@ -56,7 +59,7 @@ class RemoveSproutShieldingTest (BitcoinTestFramework):
taddr_0 = self.nodes[0].getnewaddress()
for _ in range(3):
recipients = [{"address": taddr_0, "amount": Decimal('1')}]
myopid = self.nodes[0].z_sendmany(sprout_addr, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(sprout_addr, recipients, 1, 0, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
self.nodes[0].generate(1)

View File

@ -57,7 +57,9 @@ class RESTTest (BitcoinTestFramework):
self.num_nodes = 3
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)

View File

@ -6,8 +6,10 @@
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
BLOSSOM_BRANCH_ID,
assert_equal,
get_coinbase_address,
nuparams,
start_nodes,
wait_and_assert_operationid_status,
)
@ -20,8 +22,10 @@ class ShorterBlockTimes(BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, [[
'-nuparams=2bb40e60:106', # Blossom
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
nuparams(BLOSSOM_BRANCH_ID, 106),
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_gettotalbalance',
]] * self.num_nodes)
def run_test(self):
@ -35,7 +39,7 @@ class ShorterBlockTimes(BitcoinTestFramework):
node0_taddr = get_coinbase_address(self.nodes[0])
node0_zaddr = self.nodes[0].z_getnewaddress('sapling')
recipients = [{'address': node0_zaddr, 'amount': Decimal('10.0')}]
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, 0, 'AllowRevealedSenders')
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
assert_equal(105, self.nodes[0].getrawtransaction(txid, 1)['expiryheight']) # Blossom activation - 1
self.sync_all()
@ -60,7 +64,7 @@ class ShorterBlockTimes(BitcoinTestFramework):
assert_equal(15, self.nodes[1].getwalletinfo()['immature_balance'])
# Send and mine a transaction after activation
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, 0, 'AllowRevealedSenders')
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
assert_equal(147, self.nodes[0].getrawtransaction(txid, 1)['expiryheight']) # height + 1 + 40
self.sync_all() # Ensure the transaction has propagated to node 1

View File

@ -1,7 +1,15 @@
#!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_true, initialize_chain_clean, start_node, DEFAULT_FEE
from test_framework.util import (
BLOSSOM_BRANCH_ID,
DEFAULT_FEE,
assert_equal,
assert_true,
initialize_chain_clean,
nuparams,
start_node,
)
from test_framework.authproxy import JSONRPCException
from decimal import Decimal
@ -14,7 +22,10 @@ class SignOfflineTest (BitcoinTestFramework):
initialize_chain_clean(self.options.tmpdir, 2)
def setup_network(self):
self.nodes = [ start_node(0, self.options.tmpdir, ["-nuparams=2bb40e60:10"]) ]
self.nodes = [ start_node(0, self.options.tmpdir, [
nuparams(BLOSSOM_BRANCH_ID, 10),
'-allowdeprecated=getnewaddress',
]) ]
self.is_network_split = False
self.sync_all()

View File

@ -32,7 +32,13 @@ class SpentIndexTest(BitcoinTestFramework):
self.nodes = start_nodes(
3, self.options.tmpdir,
[['-debug', '-txindex', '-experimentalfeatures', '-insightexplorer']]*3)
[[
'-debug',
'-txindex',
'-experimentalfeatures',
'-insightexplorer',
'-allowdeprecated=getnewaddress',
]]*3)
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)

View File

@ -56,6 +56,8 @@ class SproutSaplingMigration(BitcoinTestFramework):
def setup_nodes(self):
extra_args = [[
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]] * self.num_nodes
# Add migration parameters to nodes[0]
extra_args[0] = extra_args[0] + [
@ -63,8 +65,8 @@ class SproutSaplingMigration(BitcoinTestFramework):
'-migrationdestaddress=' + SAPLING_ADDR,
'-debug=zrpcunsafe'
]
assert_equal(3, len(extra_args[0]))
assert_equal(0, len(extra_args[1]))
assert_equal(5, len(extra_args[0]))
assert_equal(2, len(extra_args[1]))
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
def run_migration_test(self, node, sproutAddr, saplingAddr, target_height, sprout_initial_balance):

View File

@ -14,8 +14,11 @@ class ThreeOfThreeRestoreTest(BitcoinTestFramework):
self.num_nodes = 4
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-experimentalfeatures', '-developerencryptwallet']] * 4)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-experimentalfeatures',
'-developerencryptwallet',
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)

View File

@ -40,6 +40,10 @@ from test_framework.util import (
)
from decimal import Decimal
BASE_ARGS = [
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]
TURNSTILE_ARGS = ['-experimentalfeatures',
'-developersetpoolsizezero']
@ -51,7 +55,7 @@ class TurnstileTest (BitcoinTestFramework):
self.cache_behavior = 'clean'
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[BASE_ARGS] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
self.is_network_split=False
@ -68,7 +72,7 @@ class TurnstileTest (BitcoinTestFramework):
# Helper method to start a single node with extra args and sync to the network
def start_and_sync_node(self, index, args=[]):
self.nodes[index] = start_node(index, self.options.tmpdir, extra_args=args)
self.nodes[index] = start_node(index, self.options.tmpdir, extra_args=BASE_ARGS+args)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -119,7 +123,7 @@ class TurnstileTest (BitcoinTestFramework):
# Node 0 creates an unshielding transaction
recipients = []
recipients.append({"address": taddr0, "amount": Decimal('1')})
myopid = self.nodes[0].z_sendmany(dest_addr, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(dest_addr, recipients, 1, 0, 'AllowRevealedRecipients')
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
# Verify transaction appears in mempool of nodes

View File

@ -9,8 +9,13 @@
#
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, connect_nodes, \
sync_blocks, gather_inputs
from test_framework.util import (
assert_equal,
connect_nodes,
start_nodes,
sync_blocks,
gather_inputs,
)
class TxnMallTest(BitcoinTestFramework):
@ -19,6 +24,11 @@ class TxnMallTest(BitcoinTestFramework):
parser.add_option("--mineblock", dest="mine_block", default=False, action="store_true",
help="Test double-spend of 1-confirmed transaction")
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
def setup_network(self):
# Start with split network:
return super(TxnMallTest, self).setup_network(True)

View File

@ -19,7 +19,10 @@ class WalletTest (BitcoinTestFramework):
self.num_nodes = 4
def setup_network(self, split=False):
self.nodes = start_nodes(3, self.options.tmpdir)
self.nodes = start_nodes(3, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getbalance',
]] * 3)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -215,7 +218,7 @@ class WalletTest (BitcoinTestFramework):
# check integer balances from z_getbalance
assert_equal(self.nodes[2].z_getbalance(mytaddr, 1, True), 1000000000)
mytxdetails = self.nodes[2].gettransaction(mytxid)
mytxdetails = self.nodes[2].getrawtransaction(mytxid, 1)
myvjoinsplits = mytxdetails["vjoinsplit"]
assert_equal(0, len(myvjoinsplits))
assert("joinSplitPubKey" not in mytxdetails)

View File

@ -26,7 +26,10 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
self.nodes = start_nodes(1, self.options.tmpdir, extra_args=[[
'-regtestshieldcoinbase',
'-debug=zrpc',
'-mocktime=%d' % starttime
'-mocktime=%d' % starttime,
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]])
self.is_network_split=False
@ -35,7 +38,10 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
self.nodes.append(start_node(1, self.options.tmpdir, extra_args=[
'-regtestshieldcoinbase',
'-debug=zrpc',
'-mocktime=%d' % (starttime + 9000)
'-mocktime=%d' % (starttime + 9000),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]))
connect_nodes_bi(self.nodes,0,1)
self.sync_all()
@ -63,7 +69,7 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
# Send 10 coins to our zaddr.
recipients = []
recipients.append({"address":myzaddr, "amount":Decimal('10.0') - DEFAULT_FEE})
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.nodes[0].generate(1)

View File

@ -24,6 +24,10 @@ class WalletAccountsTest(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, [[
nuparams(NU5_BRANCH_ID, 210),
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
'-allowdeprecated=z_listaddresses',
]] * self.num_nodes)
def check_receiver_types(self, ua, expected):
@ -143,7 +147,7 @@ class WalletAccountsTest(BitcoinTestFramework):
# The wallet should detect the new note as belonging to the UA.
tx_details = self.nodes[0].z_viewtransaction(txid)
assert_equal(len(tx_details['outputs']), 1)
assert_equal(tx_details['outputs'][0]['type'], 'sapling')
assert_equal(tx_details['outputs'][0]['pool'], 'sapling')
assert_equal(tx_details['outputs'][0]['address'], ua0)
# The new balance should not be visible with the default minconf, but should be
@ -169,7 +173,7 @@ class WalletAccountsTest(BitcoinTestFramework):
# The wallet should detect the spent note as belonging to the UA.
tx_details = self.nodes[0].z_viewtransaction(txid)
assert_equal(len(tx_details['spends']), 1)
assert_equal(tx_details['spends'][0]['type'], 'sapling')
assert_equal(tx_details['spends'][0]['pool'], 'sapling')
assert_equal(tx_details['spends'][0]['address'], ua0)
# The balances of the account should reflect whether zero-conf transactions are
@ -195,7 +199,7 @@ class WalletAccountsTest(BitcoinTestFramework):
# The wallet should detect the new note as belonging to the UA.
tx_details = self.nodes[0].z_viewtransaction(txid)
assert_equal(len(tx_details['outputs']), 1)
assert_equal(tx_details['outputs'][0]['type'], 'orchard')
assert_equal(tx_details['outputs'][0]['pool'], 'orchard')
assert_equal(tx_details['outputs'][0]['address'], ua0)
# The new balance should not be visible with the default minconf, but should be
@ -225,16 +229,16 @@ class WalletAccountsTest(BitcoinTestFramework):
# The wallet should detect the spent note as belonging to the UA.
tx_details = self.nodes[0].z_viewtransaction(txid)
assert_equal(len(tx_details['spends']), 1)
assert_equal(tx_details['spends'][0]['type'], 'orchard')
assert_equal(tx_details['spends'][0]['pool'], 'orchard')
assert_equal(tx_details['spends'][0]['address'], ua0)
assert_equal(len(tx_details['outputs']), 2)
outputs = sorted(tx_details['outputs'], key=lambda x: x['valueZat'])
assert_equal(outputs[0]['type'], 'orchard')
assert_equal(outputs[0]['pool'], 'orchard')
assert_equal(outputs[0]['address'], node1orchard)
assert_equal(outputs[0]['valueZat'], 100000000)
# outputs[1] is change
assert_equal(outputs[1]['type'], 'orchard')
assert_equal(outputs[1]['pool'], 'orchard')
assert_true('address' not in outputs[1]) #
# The balances of the account should reflect whether zero-conf transactions are

View File

@ -24,8 +24,11 @@ class WalletAddressesTest(BitcoinTestFramework):
def setup_network(self):
self.nodes = start_nodes(
self.num_nodes, self.options.tmpdir,
extra_args=[[nuparams(NU5_BRANCH_ID, 2),]] * self.num_nodes)
self.num_nodes, self.options.tmpdir, extra_args=[[
nuparams(NU5_BRANCH_ID, 2),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes, 0, 1)
self.is_network_split = False
self.sync_all()
@ -86,7 +89,7 @@ class WalletAddressesTest(BitcoinTestFramework):
res = self.nodes[0].z_validateaddress(addr)
assert res['isvalid']
# assert res['ismine'] # this isn't present for unified addresses
assert_equal(res['type'], addr_type)
assert_equal(res['address_type'], addr_type)
# We should see the following sources:
# - imported_watchonly (for the previously-imported t-addr)
@ -147,7 +150,7 @@ class WalletAddressesTest(BitcoinTestFramework):
res = self.nodes[0].z_validateaddress(addr)
assert res['isvalid']
# assert res['ismine'] # this isn't present for unified addresses
assert_equal(res['type'], addr_type)
assert_equal(res['address_type'], addr_type)
# We should see the same sources (address generation does not change across the NU5 boundary).
listed_addresses = self.list_addresses(0, ['imported_watchonly', 'legacy_random', 'mnemonic_seed'])

View File

@ -18,7 +18,11 @@ class WalletAnchorForkTest (BitcoinTestFramework):
# Start nodes with -regtestshieldcoinbase to set fCoinbaseMustBeShielded to true.
def setup_network(self, split=False):
self.nodes = start_nodes(3, self.options.tmpdir, extra_args=[['-regtestshieldcoinbase', '-debug=zrpc']] * 3 )
self.nodes = start_nodes(3, self.options.tmpdir, extra_args=[[
'-regtestshieldcoinbase',
'-debug=zrpc',
'-allowdeprecated=z_getnewaddress',
]] * 3)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -49,7 +53,7 @@ class WalletAnchorForkTest (BitcoinTestFramework):
myzaddr0 = self.nodes[0].z_getnewaddress()
recipients = []
recipients.append({"address":myzaddr0, "amount": Decimal('10.0') - DEFAULT_FEE})
myopid = self.nodes[0].z_sendmany(mytaddr0, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr0, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
# Sync up mempools and mine the transaction. All nodes have the same anchor.
@ -73,7 +77,7 @@ class WalletAnchorForkTest (BitcoinTestFramework):
# Partition A, node 0 creates a joinsplit transaction
recipients = []
recipients.append({"address":myzaddr0, "amount": Decimal('10.0') - DEFAULT_FEE})
myopid = self.nodes[0].z_sendmany(mytaddr0, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr0, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
rawhex = self.nodes[0].getrawtransaction(txid)

View File

@ -7,13 +7,17 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, connect_nodes_bi, start_nodes, stop_nodes, sync_blocks, wait_bitcoinds
from decimal import Decimal
BASE_ARGS = [
'-allowdeprecated=getnewaddress',
]
# Test wallet address behaviour across network upgrades
class WalletBroadcastTest(BitcoinTestFramework):
def run_test(self):
#do some -walletbroadcast tests
stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir, [["-walletbroadcast=0"]] * 3)
self.nodes = start_nodes(3, self.options.tmpdir, [BASE_ARGS + ["-walletbroadcast=0"]] * 3)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -42,7 +46,7 @@ class WalletBroadcastTest(BitcoinTestFramework):
#restart the nodes with -walletbroadcast=1
stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir)
self.nodes = start_nodes(3, self.options.tmpdir, [BASE_ARGS] * 3)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)

View File

@ -5,9 +5,11 @@
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
SAPLING_BRANCH_ID,
connect_nodes_bi,
get_coinbase_address,
initialize_chain_clean,
nuparams,
start_node,
wait_and_assert_operationid_status,
)
@ -23,9 +25,10 @@ class WalletChangeAddressesTest(BitcoinTestFramework):
def setup_network(self):
args = [
'-nuparams=5ba81b19:1', # Overwinter
'-nuparams=76b809bb:1', # Sapling
'-txindex' # Avoid JSONRPC error: No information available about transaction
nuparams(SAPLING_BRANCH_ID, 1),
'-txindex', # Avoid JSONRPC error: No information available about transaction
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, args))
@ -48,21 +51,21 @@ class WalletChangeAddressesTest(BitcoinTestFramework):
taddrSource = self.nodes[0].getnewaddress()
for _ in range(6):
recipients = [{"address": taddrSource, "amount": Decimal('2')}]
myopid = self.nodes[0].z_sendmany(midAddr, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(midAddr, recipients, 1, 0, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
self.nodes[1].generate(1)
self.sync_all()
def check_change_taddr_reuse(target):
def check_change_taddr_reuse(target, policy):
recipients = [{"address": target, "amount": Decimal('1')}]
# Send funds to recipient address twice
myopid = self.nodes[0].z_sendmany(taddrSource, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(taddrSource, recipients, 1, 0, policy)
txid1 = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.nodes[1].generate(1)
self.sync_all()
myopid = self.nodes[0].z_sendmany(taddrSource, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(taddrSource, recipients, 1, 0, policy)
txid2 = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.nodes[1].generate(1)
self.sync_all()
@ -84,10 +87,10 @@ class WalletChangeAddressesTest(BitcoinTestFramework):
print()
print('Checking z_sendmany(taddr->Sapling)')
check_change_taddr_reuse(saplingAddr)
check_change_taddr_reuse(saplingAddr, 'AllowRevealedSenders')
print()
print('Checking z_sendmany(taddr->taddr)')
check_change_taddr_reuse(taddr)
check_change_taddr_reuse(taddr, 'AllowFullyTransparent')
if __name__ == '__main__':
WalletChangeAddressesTest().main()

View File

@ -4,7 +4,13 @@
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_true, assert_false, wait_and_assert_operationid_status
from test_framework.util import (
assert_equal,
assert_false,
assert_true,
start_nodes,
wait_and_assert_operationid_status,
)
from decimal import Decimal
@ -15,6 +21,12 @@ class WalletChangeIndicatorTest (BitcoinTestFramework):
self.nodes[0].generate(1)
self.sync_all()
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]] * self.num_nodes)
# Tests
def run_test(self):
taddr = self.nodes[1].getnewaddress()
@ -25,7 +37,12 @@ class WalletChangeIndicatorTest (BitcoinTestFramework):
self.generate_and_sync()
# Send 1 ZEC to a zaddr
wait_and_assert_operationid_status(self.nodes[1], self.nodes[1].z_sendmany(taddr, [{'address': zaddr1, 'amount': 1.0, 'memo': 'c0ffee01'}], 1, 0))
wait_and_assert_operationid_status(
self.nodes[1],
self.nodes[1].z_sendmany(
taddr,
[{'address': zaddr1, 'amount': 1.0, 'memo': 'c0ffee01'}],
1, 0, 'AllowRevealedSenders'))
self.generate_and_sync()
# Check that we have received 1 note which is not change

View File

@ -54,10 +54,10 @@ class WalletDeprecationTest(BitcoinTestFramework):
# Pick a subset of the deprecated RPC methods to test with. This test assumes that
# the deprecation feature name is the same as the RPC method name.
DEFAULT_ENABLED = [
"getnewaddress",
"z_getnewaddress",
]
DEFAULT_DISABLED = [
"getnewaddress",
"z_getnewaddress",
]
# RPC methods that are deprecated but enabled by default should succeed

View File

@ -12,6 +12,8 @@ class WalletImportExportTest (BitcoinTestFramework):
num_nodes = 3
extra_args = [([
"-exportdir={}/export{}".format(self.options.tmpdir, i),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
] + (["-walletrequirebackup"] if i == 0 else [])) for i in range(num_nodes)]
self.nodes = start_nodes(num_nodes, self.options.tmpdir, extra_args)

View File

@ -31,6 +31,8 @@ class WalletIsFromMe(BitcoinTestFramework):
nuparams(BLOSSOM_BRANCH_ID, 1),
nuparams(HEARTWOOD_BRANCH_ID, 1),
nuparams(CANOPY_BRANCH_ID, 1),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]])
self.is_network_split=False
@ -53,6 +55,7 @@ class WalletIsFromMe(BitcoinTestFramework):
],
0,
0,
'AllowRevealedSenders',
),
)
self.sync_all()
@ -74,6 +77,7 @@ class WalletIsFromMe(BitcoinTestFramework):
],
1,
0,
'AllowRevealedRecipients',
),
)
self.sync_all()

View File

@ -22,6 +22,8 @@ class WalletListNotes(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(4, self.options.tmpdir, [[
nuparams(NU5_BRANCH_ID, 215),
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_gettotalbalance',
]] * 4)
def run_test(self):
@ -75,9 +77,9 @@ class WalletListNotes(BitcoinTestFramework):
saplingzaddr = self.nodes[0].z_getnewaddress('sapling')
receive_amount_2 = Decimal('1.0')
change_amount_2 = receive_amount_1 - receive_amount_2 - DEFAULT_FEE
assert_equal('sapling', self.nodes[0].z_validateaddress(saplingzaddr)['type'])
assert_equal('sapling', self.nodes[0].z_validateaddress(saplingzaddr)['address_type'])
recipients = [{"address": saplingzaddr, "amount":receive_amount_2}]
myopid = self.nodes[0].z_sendmany(sproutzaddr, recipients, 1, DEFAULT_FEE)
myopid = self.nodes[0].z_sendmany(sproutzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedAmounts')
txid_2 = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
@ -116,7 +118,7 @@ class WalletListNotes(BitcoinTestFramework):
receive_amount_3 = Decimal('2.0')
change_amount_3 = change_amount_2 - receive_amount_3 - DEFAULT_FEE
recipients = [{"address": saplingzaddr2, "amount":receive_amount_3}]
myopid = self.nodes[0].z_sendmany(sproutzaddr, recipients, 1, DEFAULT_FEE)
myopid = self.nodes[0].z_sendmany(sproutzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedAmounts')
txid_3 = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
unspent_tx = self.nodes[0].z_listunspent(0)

View File

@ -37,6 +37,8 @@ class ListReceivedTest (BitcoinTestFramework):
self.num_nodes, self.options.tmpdir,
extra_args=[[
nuparams(NU5_BRANCH_ID, 225),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]] * self.num_nodes
)
connect_nodes_bi(self.nodes, 0, 1)
@ -79,7 +81,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(pt['txid'], txid_shielding1)
assert_equal(len(pt['spends']), 0)
assert_equal(len(pt['outputs']), 1)
assert_equal(pt['outputs'][0]['type'], 'sprout')
assert_equal(pt['outputs'][0]['pool'], 'sprout')
assert_equal(pt['outputs'][0]['js'], 0)
assert_equal(pt['outputs'][0]['address'], zaddr1)
assert_equal(pt['outputs'][0]['value'], Decimal('10'))
@ -99,7 +101,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(pt['txid'], txid_shieldingExt)
assert_equal(len(pt['spends']), 0)
assert_equal(len(pt['outputs']), 1)
assert_equal(pt['outputs'][0]['type'], 'sprout')
assert_equal(pt['outputs'][0]['pool'], 'sprout')
assert_equal(pt['outputs'][0]['js'], 0)
assert_equal(pt['outputs'][0]['address'], zaddrExt)
assert_equal(pt['outputs'][0]['value'], Decimal('10'))
@ -142,7 +144,7 @@ class ListReceivedTest (BitcoinTestFramework):
taddr = self.nodes[1].getnewaddress()
# Generate some change by sending part of zaddr1 back to taddr
opid = self.nodes[1].z_sendmany(zaddr1, [{'address': taddr, 'amount': 0.6}], 1)
opid = self.nodes[1].z_sendmany(zaddr1, [{'address': taddr, 'amount': 0.6}], 1, DEFAULT_FEE, 'AllowRevealedRecipients')
txid = wait_and_assert_operationid_status(self.nodes[1], opid)
self.generate_and_sync(height+4)
@ -155,7 +157,7 @@ class ListReceivedTest (BitcoinTestFramework):
# assert_equal(len(pt['outputs']), 2)
assert_equal(len(pt['outputs']), 1)
assert_equal(pt['spends'][0]['type'], 'sprout')
assert_equal(pt['spends'][0]['pool'], 'sprout')
assert_equal(pt['spends'][0]['txidPrev'], txid_shielding1)
assert_equal(pt['spends'][0]['js'], 0)
assert_equal(pt['spends'][0]['jsPrev'], 0)
@ -167,7 +169,7 @@ class ListReceivedTest (BitcoinTestFramework):
# We expect a transparent output and a Sprout output, but the RPC does
# not define any particular ordering of these within the returned JSON.
outputs = [{
'type': output['type'],
'pool': output['pool'],
'address': output['address'],
'value': output['value'],
'valueZat': output['valueZat'],
@ -178,13 +180,13 @@ class ListReceivedTest (BitcoinTestFramework):
# TODO: enable once z_viewtransaction displays transparent elements
# assert({
# 'type': 'transparent',
# 'pool': 'transparent',
# 'address': taddr,
# 'value': Decimal('0.6'),
# 'valueZat': 60000000,
# } in outputs)
assert({
'type': 'sprout',
'pool': 'sprout',
'address': zaddr1,
'value': Decimal('9.4') - DEFAULT_FEE,
'valueZat': 940000000 - DEFAULT_FEE_ZATS,
@ -220,7 +222,7 @@ class ListReceivedTest (BitcoinTestFramework):
opid = self.nodes[1].z_sendmany(taddr, [
{'address': zaddr1, 'amount': 1, 'memo': my_memo},
{'address': zaddrExt, 'amount': 2},
], 1)
], 1, DEFAULT_FEE, 'AllowRevealedSenders')
txid = wait_and_assert_operationid_status(self.nodes[1], opid)
self.sync_all()
@ -233,7 +235,7 @@ class ListReceivedTest (BitcoinTestFramework):
# Outputs are not returned in a defined order but the amounts are deterministic
outputs = sorted(pt['outputs'], key=lambda x: x['valueZat'])
assert_equal(outputs[0]['type'], 'sapling')
assert_equal(outputs[0]['pool'], 'sapling')
assert_equal(outputs[0]['address'], zaddr1)
assert_equal(outputs[0]['value'], Decimal('1'))
assert_equal(outputs[0]['valueZat'], 100000000)
@ -242,7 +244,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(outputs[0]['memo'], my_memo)
assert_equal(outputs[0]['memoStr'], my_memo_str)
assert_equal(outputs[1]['type'], 'sapling')
assert_equal(outputs[1]['pool'], 'sapling')
assert_equal(outputs[1]['address'], zaddrExt)
assert_equal(outputs[1]['value'], Decimal('2'))
assert_equal(outputs[1]['valueZat'], 200000000)
@ -298,7 +300,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(len(pt['spends']), 1)
assert_equal(len(pt['outputs']), 2)
assert_equal(pt['spends'][0]['type'], 'sapling')
assert_equal(pt['spends'][0]['pool'], 'sapling')
assert_equal(pt['spends'][0]['txidPrev'], txidPrev)
assert_equal(pt['spends'][0]['spend'], 0)
assert_equal(pt['spends'][0]['outputPrev'], 0)
@ -308,7 +310,7 @@ class ListReceivedTest (BitcoinTestFramework):
# Outputs are not returned in a defined order but the amounts are deterministic
outputs = sorted(pt['outputs'], key=lambda x: x['valueZat'])
assert_equal(outputs[0]['type'], 'sapling')
assert_equal(outputs[0]['pool'], 'sapling')
assert_equal(outputs[0]['address'], zaddr1)
assert_equal(outputs[0]['value'], Decimal('0.4') - DEFAULT_FEE)
assert_equal(outputs[0]['valueZat'], 40000000 - DEFAULT_FEE_ZATS)
@ -317,7 +319,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(outputs[0]['memo'], no_memo)
assert 'memoStr' not in outputs[0]
assert_equal(outputs[1]['type'], 'sapling')
assert_equal(outputs[1]['pool'], 'sapling')
assert_equal(outputs[1]['address'], zaddr2)
assert_equal(outputs[1]['value'], Decimal('0.6'))
assert_equal(outputs[1]['valueZat'], 60000000)
@ -476,7 +478,7 @@ class ListReceivedTest (BitcoinTestFramework):
# Outputs are not returned in a defined order but the amounts are deterministic
outputs = sorted(pt['outputs'], key=lambda x: x['valueZat'])
assert_equal(outputs[0]['type'], 'orchard')
assert_equal(outputs[0]['pool'], 'orchard')
assert_equal(outputs[0]['address'], uao)
assert_equal(outputs[0]['value'], Decimal('1'))
assert_equal(outputs[0]['valueZat'], 100000000)
@ -485,7 +487,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(outputs[0]['memoStr'], my_memo_str)
actionToSpend = outputs[0]['action']
assert_equal(outputs[1]['type'], 'orchard')
assert_equal(outputs[1]['pool'], 'orchard')
assert_equal(outputs[1]['address'], uaso)
assert_equal(outputs[1]['value'], Decimal('2'))
assert_equal(outputs[1]['valueZat'], 200000000)
@ -509,7 +511,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(len(pt['outputs']), 3) # one output + one change output we can see
spends = pt['spends']
assert_equal(spends[0]['type'], 'orchard')
assert_equal(spends[0]['pool'], 'orchard')
assert_equal(spends[0]['txidPrev'], txid0)
assert_equal(spends[0]['actionPrev'], actionToSpend)
assert_equal(spends[0]['address'], uao)
@ -517,7 +519,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(spends[0]['valueZat'], 100000000)
outputs = sorted(pt['outputs'], key=lambda x: x['valueZat'])
assert_equal(outputs[0]['type'], 'orchard')
assert_equal(outputs[0]['pool'], 'orchard')
assert_equal(outputs[0]['address'], ua_node0)
assert_equal(outputs[0]['value'], Decimal('0.2'))
assert_equal(outputs[0]['valueZat'], 20000000)
@ -525,7 +527,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(outputs[0]['walletInternal'], False)
assert_equal(outputs[0]['memo'], no_memo)
assert_equal(outputs[1]['type'], 'orchard')
assert_equal(outputs[1]['pool'], 'orchard')
assert_equal(outputs[1]['address'], uaso)
assert_equal(outputs[1]['value'], Decimal('0.3'))
assert_equal(outputs[1]['valueZat'], 30000000)
@ -534,7 +536,7 @@ class ListReceivedTest (BitcoinTestFramework):
assert_equal(outputs[1]['memo'], no_memo)
# Verify that we observe the change output
assert_equal(outputs[2]['type'], 'orchard')
assert_equal(outputs[2]['pool'], 'orchard')
assert_equal(outputs[2]['value'], Decimal('0.49999'))
assert_equal(outputs[2]['valueZat'], 49999000)
assert_equal(outputs[2]['outgoing'], False)

View File

@ -22,6 +22,7 @@ class WalletListUnspent(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(4, self.options.tmpdir, [[
nuparams(NU5_BRANCH_ID, 201),
'-allowdeprecated=getnewaddress',
]] * 4)
def matured_at_height(self, height):

View File

@ -13,8 +13,15 @@ from decimal import Decimal
class WalletNullifiersTest (BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-experimentalfeatures', '-developerencryptwallet']] * self.num_nodes)
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-experimentalfeatures',
'-developerencryptwallet',
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
'-allowdeprecated=z_listaddresses',
]] * self.num_nodes)
def run_test (self):
# add zaddr to node 0
@ -26,7 +33,10 @@ class WalletNullifiersTest (BitcoinTestFramework):
recipients = []
recipients.append({"address": myzaddr0, "amount": Decimal('10.0') - DEFAULT_FEE}) # utxo amount less fee
wait_and_assert_operationid_status(self.nodes[0], self.nodes[0].z_sendmany(mytaddr, recipients), timeout=120)
wait_and_assert_operationid_status(
self.nodes[0],
self.nodes[0].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders'),
timeout=120)
self.sync_all()
self.nodes[0].generate(1)
@ -44,7 +54,10 @@ class WalletNullifiersTest (BitcoinTestFramework):
bitcoind_processes[1].wait()
# restart node 1
self.nodes[1] = start_node(1, self.options.tmpdir)
self.nodes[1] = start_node(1, self.options.tmpdir, [
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getbalance',
])
connect_nodes_bi(self.nodes, 0, 1)
connect_nodes_bi(self.nodes, 1, 2)
self.sync_all()
@ -93,7 +106,10 @@ class WalletNullifiersTest (BitcoinTestFramework):
recipients = []
recipients.append({"address":mytaddr1, "amount":1.0})
wait_and_assert_operationid_status(self.nodes[1], self.nodes[1].z_sendmany(myzaddr, recipients, 1), timeout=120)
wait_and_assert_operationid_status(
self.nodes[1],
self.nodes[1].z_sendmany(myzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedRecipients'),
timeout=120)
self.sync_all()
self.nodes[1].generate(1)
@ -120,7 +136,7 @@ class WalletNullifiersTest (BitcoinTestFramework):
importvk_result = self.nodes[3].z_importviewingkey(myzvkey, 'whenkeyisnew', 1)
# Check results of z_importviewingkey
assert_equal(importvk_result["type"], "sapling")
assert_equal(importvk_result["address_type"], "sapling")
assert_equal(importvk_result["address"], myzaddr)
# Check the address has been imported

View File

@ -29,6 +29,9 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
"-nuparams=2bb40e60:200",
"-debug=zrpcunsafe",
"-txindex",
"-allowdeprecated=getnewaddress",
"-allowdeprecated=z_getnewaddress",
"-allowdeprecated=z_getbalance",
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
@ -67,7 +70,7 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
# Node 2 sends the zero-confirmation transparent funds to Node 1 using z_sendmany
recipients = []
recipients.append({"address":taddr1, "amount": Decimal('0.5')})
myopid = self.nodes[2].z_sendmany(taddr2, recipients, 0)
myopid = self.nodes[2].z_sendmany(taddr2, recipients, 0, DEFAULT_FEE, 'AllowFullyTransparent')
txid_zsendmany = wait_and_assert_operationid_status(self.nodes[2], myopid)
# Node 0 shields to Node 2, a coinbase utxo of value 10.0 less default fee
@ -136,7 +139,7 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
# Node 3 sends the zero-confirmation transparent funds to Node 1 using z_sendmany
recipients = []
recipients.append({"address":taddr1, "amount": Decimal('0.5')})
myopid = self.nodes[3].z_sendmany(taddr3, recipients, 0)
myopid = self.nodes[3].z_sendmany(taddr3, recipients, 0, DEFAULT_FEE, 'AllowFullyTransparent')
txid_zsendmany = wait_and_assert_operationid_status(self.nodes[3], myopid)
# Node 0 shields to Node 3, a coinbase utxo of value 10.0 less default fee

View File

@ -11,7 +11,10 @@ from decimal import Decimal
# Test wallet address behaviour across network upgrades
class WalletAmountParsingTest(BitcoinTestFramework):
def setup_network(self, split=False):
self.nodes = start_nodes(3, self.options.tmpdir)
self.nodes = start_nodes(3, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
]] * 3)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)

View File

@ -20,7 +20,12 @@ class WalletPersistenceTest (BitcoinTestFramework):
initialize_chain_clean(self.options.tmpdir, 4)
def setup_network(self, split=False):
self.nodes = start_nodes(4, self.options.tmpdir)
self.nodes = start_nodes(4, self.options.tmpdir, extra_args=[[
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
'-allowdeprecated=z_listaddresses',
]] * 4)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,2,3)
@ -53,7 +58,7 @@ class WalletPersistenceTest (BitcoinTestFramework):
taddr0 = get_coinbase_address(self.nodes[0])
recipients = []
recipients.append({"address": sapling_addr, "amount": Decimal('20')})
myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()

View File

@ -8,6 +8,7 @@ from test_framework.authproxy import JSONRPCException
from test_framework.util import (
assert_equal,
get_coinbase_address,
start_nodes,
wait_and_assert_operationid_status,
DEFAULT_FEE
)
@ -17,6 +18,15 @@ from decimal import Decimal
# Test wallet behaviour with Sapling addresses
class WalletSaplingTest(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
'-allowdeprecated=z_listaddresses',
]] * self.num_nodes)
def run_test(self):
# Sanity-check the test harness
assert_equal(self.nodes[0].getblockcount(), 200)
@ -28,8 +38,8 @@ class WalletSaplingTest(BitcoinTestFramework):
# Verify addresses
assert(saplingAddr0 in self.nodes[0].z_listaddresses())
assert(saplingAddr1 in self.nodes[1].z_listaddresses())
assert_equal(self.nodes[0].z_validateaddress(saplingAddr0)['type'], 'sapling')
assert_equal(self.nodes[0].z_validateaddress(saplingAddr1)['type'], 'sapling')
assert_equal(self.nodes[0].z_validateaddress(saplingAddr0)['address_type'], 'sapling')
assert_equal(self.nodes[0].z_validateaddress(saplingAddr1)['address_type'], 'sapling')
# Verify balance
assert_equal(self.nodes[0].z_getbalance(saplingAddr0), Decimal('0'))
@ -40,7 +50,7 @@ class WalletSaplingTest(BitcoinTestFramework):
# taddr -> Sapling
recipients = []
recipients.append({"address": saplingAddr0, "amount": Decimal('10')})
myopid = self.nodes[0].z_sendmany(get_coinbase_address(self.nodes[0]), recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(get_coinbase_address(self.nodes[0]), recipients, 1, 0, 'AllowRevealedSenders')
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
@ -50,7 +60,7 @@ class WalletSaplingTest(BitcoinTestFramework):
assert(Decimal(mempool[mytxid]['startingpriority']) == Decimal('1E+16'))
# Shield another coinbase UTXO
myopid = self.nodes[0].z_sendmany(get_coinbase_address(self.nodes[0]), recipients, 1, 0)
myopid = self.nodes[0].z_sendmany(get_coinbase_address(self.nodes[0]), recipients, 1, 0, 'AllowRevealedSenders')
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
@ -91,7 +101,7 @@ class WalletSaplingTest(BitcoinTestFramework):
recipients = []
recipients.append({"address": saplingAddr0, "amount": Decimal('5')})
recipients.append({"address": taddr1, "amount": Decimal('5')})
myopid = self.nodes[1].z_sendmany(saplingAddr1, recipients, 1, 0)
myopid = self.nodes[1].z_sendmany(saplingAddr1, recipients, 1, 0, 'AllowRevealedRecipients')
mytxid = wait_and_assert_operationid_status(self.nodes[1], myopid)
self.sync_all()
@ -132,24 +142,24 @@ class WalletSaplingTest(BitcoinTestFramework):
# Verify importing a spending key will update the nullifiers and witnesses correctly
sk0 = self.nodes[0].z_exportkey(saplingAddr0)
saplingAddrInfo0 = self.nodes[2].z_importkey(sk0, "yes")
assert_equal(saplingAddrInfo0["type"], "sapling")
assert_equal(saplingAddrInfo0["address_type"], "sapling")
assert_equal(saplingAddrInfo0["address"], saplingAddr0)
assert_equal(self.nodes[2].z_getbalance(saplingAddrInfo0["address"]), Decimal('10'))
sk1 = self.nodes[1].z_exportkey(saplingAddr1)
saplingAddrInfo1 = self.nodes[2].z_importkey(sk1, "yes")
assert_equal(saplingAddrInfo1["type"], "sapling")
assert_equal(saplingAddrInfo1["address_type"], "sapling")
assert_equal(saplingAddrInfo1["address"], saplingAddr1)
assert_equal(self.nodes[2].z_getbalance(saplingAddrInfo1["address"]), Decimal('5'))
# Verify importing a viewing key will update the nullifiers and witnesses correctly
extfvk0 = self.nodes[0].z_exportviewingkey(saplingAddr0)
saplingAddrInfo0 = self.nodes[3].z_importviewingkey(extfvk0, "yes")
assert_equal(saplingAddrInfo0["type"], "sapling")
assert_equal(saplingAddrInfo0["address_type"], "sapling")
assert_equal(saplingAddrInfo0["address"], saplingAddr0)
assert_equal(self.nodes[3].z_getbalance(saplingAddrInfo0["address"]), Decimal('10'))
extfvk1 = self.nodes[1].z_exportviewingkey(saplingAddr1)
saplingAddrInfo1 = self.nodes[3].z_importviewingkey(extfvk1, "yes")
assert_equal(saplingAddrInfo1["type"], "sapling")
assert_equal(saplingAddrInfo1["address_type"], "sapling")
assert_equal(saplingAddrInfo1["address"], saplingAddr1)
assert_equal(self.nodes[3].z_getbalance(saplingAddrInfo1["address"]), Decimal('5'))
@ -165,7 +175,7 @@ class WalletSaplingTest(BitcoinTestFramework):
taddr1,
[{'address': node4_sproutaddr, 'amount': Decimal('2.5')},
{'address': node4_saplingaddr, 'amount': Decimal('2.5') - DEFAULT_FEE}],
1, DEFAULT_FEE
1, DEFAULT_FEE, 'AllowRevealedSenders'
)
raise AssertionError("Should have thrown an exception")
except JSONRPCException as e:

View File

@ -5,6 +5,7 @@
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
DEFAULT_FEE,
assert_equal,
connect_nodes_bi,
start_nodes,
@ -21,6 +22,9 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
return start_nodes(self.num_nodes, self.options.tmpdir,
[[
"-txexpirydelta=%d" % TX_EXPIRY_DELTA,
"-allowdeprecated=getnewaddress",
"-allowdeprecated=z_getnewaddress",
"-allowdeprecated=z_getbalance",
]] * self.num_nodes)
def run_test(self):
@ -53,7 +57,9 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
{'address': node3taddr1, 'amount': 60},
{'address': node3taddr2, 'amount': 75},
],
1
1,
DEFAULT_FEE,
'AllowRevealedRecipients',
),
)
self.sync_all()
@ -68,7 +74,10 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
# We should be able to spend multiple UTXOs at once
wait_and_assert_operationid_status(
self.nodes[3],
self.nodes[3].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 100}], 1),
self.nodes[3].z_sendmany(
'ANY_TADDR',
[{'address': recipient, 'amount': 100}],
1, DEFAULT_FEE, 'AllowRevealedSenders'),
)
self.sync_all()
@ -85,7 +94,10 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
# Send from a change t-address.
wait_and_assert_operationid_status(
self.nodes[3],
self.nodes[3].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 20}], 1),
self.nodes[3].z_sendmany(
'ANY_TADDR',
[{'address': recipient, 'amount': 20}],
1, DEFAULT_FEE, 'AllowRevealedSenders'),
)
self.sync_all()
@ -96,7 +108,10 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
assert_equal(self.nodes[1].z_getbalance(recipient), 120)
# Check that ANY_TADDR note selection doesn't attempt a double-spend
myopid = self.nodes[3].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 20}], 1)
myopid = self.nodes[3].z_sendmany(
'ANY_TADDR',
[{'address': recipient, 'amount': 20}],
1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "Insufficient funds: have 14.99998, need 20.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
# Create an expired transaction on node 3.
@ -123,7 +138,13 @@ class WalletSendManyAnyTaddr(BitcoinTestFramework):
assert_equal(0, self.nodes[2].getbalance())
# Check that ANY_TADDR doesn't select an expired output.
wait_and_assert_operationid_status(self.nodes[2], self.nodes[2].z_sendmany('ANY_TADDR', [{'address': recipient, 'amount': 13}]), "failed", "Insufficient funds: have 0.00, need 13.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
wait_and_assert_operationid_status(
self.nodes[2],
self.nodes[2].z_sendmany(
'ANY_TADDR',
[{'address': recipient, 'amount': 13}],
1, DEFAULT_FEE, 'AllowRevealedSenders'),
"failed", "Insufficient funds: have 0.00, need 13.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
if __name__ == '__main__':
WalletSendManyAnyTaddr().main()

View File

@ -22,6 +22,8 @@ class WalletShieldCoinbaseTest (BitcoinTestFramework):
'-regtestprotectcoinbase',
'-debug=zrpcunsafe',
nuparams(NU5_BRANCH_ID, self.nu5_activation),
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, args))

View File

@ -32,13 +32,13 @@ class WalletShieldCoinbaseUANU5(WalletShieldCoinbaseTest):
# While we're at it, check that z_listunspent only shows outputs with
# the Unified Address (not the Orchard receiver), and of the expected
# type.
# pool.
unspent = node.z_listunspent(1, 999999, False, [self.addr])
assert_equal(
# TODO: Fix after Orchard support is added to z_shieldcoinbase
#[{'type': 'orchard', 'address': self.addr} for _ in unspent],
[{'type': 'sapling', 'address': self.addr} for _ in unspent],
[{'type': x['type'], 'address': x['address']} for x in unspent],
#[{'pool': 'orchard', 'address': self.addr} for _ in unspent],
[{'pool': 'sapling', 'address': self.addr} for _ in unspent],
[{'pool': x['pool'], 'address': x['address']} for x in unspent],
)
total_balance = node.z_getbalance(self.addr) * COIN

View File

@ -27,11 +27,11 @@ class WalletShieldCoinbaseUASapling(WalletShieldCoinbaseTest):
# While we're at it, check that z_listunspent only shows outputs with
# the Unified Address (not the Sapling receiver), and of the expected
# type.
# pool.
unspent = node.z_listunspent(1, 999999, False, [self.addr])
assert_equal(
[{'type': 'sapling', 'address': self.addr} for _ in unspent],
[{'type': x['type'], 'address': x['address']} for x in unspent],
[{'pool': 'sapling', 'address': self.addr} for _ in unspent],
[{'pool': x['pool'], 'address': x['address']} for x in unspent],
)
total_balance = node.z_getbalance(self.addr) * COIN

View File

@ -34,7 +34,14 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
# Start nodes with -regtestshieldcoinbase to set fCoinbaseMustBeShielded to true.
def setup_network(self, split=False):
self.nodes = start_nodes(4, self.options.tmpdir, extra_args=[['-regtestshieldcoinbase', '-debug=zrpcunsafe']] * 4 )
self.nodes = start_nodes(4, self.options.tmpdir, extra_args=[[
'-regtestshieldcoinbase',
'-debug=zrpcunsafe',
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
]] * 4 )
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -96,7 +103,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
recipients = []
recipients.append({"address":myzaddr, "amount":Decimal('1.23456789')})
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 10, DEFAULT_FEE, 'AllowRevealedSenders')
error_result = wait_and_assert_operationid_status_result(
self.nodes[0],
myopid, "failed",
@ -120,7 +127,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
shieldvalue = Decimal('20.0') - DEFAULT_FEE
recipients = []
recipients.append({"address":myzaddr, "amount": shieldvalue})
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 10, DEFAULT_FEE, 'AllowRevealedSenders')
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
@ -129,7 +136,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
assert(len(results) == 0)
results = self.nodes[0].z_listunspent(0) # set minconf to zero
assert(len(results) == 1)
assert_equal(results[0]["type"], "sapling")
assert_equal(results[0]["pool"], "sapling")
assert_equal(results[0]["address"], myzaddr)
assert_equal(results[0]["amount"], shieldvalue)
assert_equal(results[0]["confirmations"], 0)
@ -141,7 +148,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
# Verify that z_listunspent returns one note which has been confirmed
results = self.nodes[0].z_listunspent()
assert(len(results) == 1)
assert_equal(results[0]["type"], "sapling")
assert_equal(results[0]["pool"], "sapling")
assert_equal(results[0]["address"], myzaddr)
assert_equal(results[0]["amount"], shieldvalue)
assert_equal(results[0]["confirmations"], 1)
@ -150,7 +157,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
# Verify that z_listunspent returns note for watchonly address on node 3.
results = self.nodes[3].z_listunspent(1, 999, True)
assert(len(results) == 1)
assert_equal(results[0]["type"], "sapling")
assert_equal(results[0]["pool"], "sapling")
assert_equal(results[0]["address"], myzaddr)
assert_equal(results[0]["amount"], shieldvalue)
assert_equal(results[0]["confirmations"], 1)
@ -198,7 +205,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
unshieldvalue = Decimal('10.0')
recipients = []
recipients.append({"address":mytaddr, "amount": unshieldvalue})
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, 1)
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedRecipients')
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
assert(mytxid is not None)
self.sync_all()
@ -240,7 +247,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
recipients.append({"address":self.nodes[1].getnewaddress(), "amount":Decimal('10000.0')})
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1)
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Insufficient funds: have 10.00, need 10000.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, 1)
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Insufficient funds: have 9.99998, need 10000.00001; note that coinbase outputs will not be selected if you specify ANY_TADDR or if any transparent recipients are included.")
# Send will fail because of insufficient funds unless sender uses coinbase utxos
@ -276,14 +283,14 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
self.nodes[0].getinfo()
# Issue #2263 Workaround END
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, 1)
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedRecipients')
try:
wait_and_assert_operationid_status(self.nodes[0], myopid)
except JSONRPCException as e:
print("JSONRPC error: "+e.error['message'])
assert(False)
except Exception as e:
print("Unexpected exception caught during testing: ", e.error['message'], str(sys.exc_info()[0]))
print("Unexpected exception caught during testing: ", e, str(sys.exc_info()[0]))
assert(False)
self.sync_all()

View File

@ -19,7 +19,12 @@ class WalletTreeStateTest (BitcoinTestFramework):
# Start nodes with -regtestshieldcoinbase to set fCoinbaseMustBeShielded to true.
def setup_network(self, split=False):
self.nodes = start_nodes(3, self.options.tmpdir, extra_args=[['-regtestshieldcoinbase','-debug=zrpc']] * 3 )
self.nodes = start_nodes(3, self.options.tmpdir, extra_args=[[
'-regtestshieldcoinbase',
'-debug=zrpc',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
]] * 3 )
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -40,17 +45,17 @@ class WalletTreeStateTest (BitcoinTestFramework):
# Spend coinbase utxos to create three notes of 10 ZEC minus default fee each
recipients = []
recipients.append({"address": myzaddr, "amount": Decimal('10.0') - DEFAULT_FEE})
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
self.nodes[1].generate(1)
self.sync_all()
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
self.nodes[1].generate(1)
self.sync_all()
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all()
self.nodes[1].generate(1)
@ -67,7 +72,7 @@ class WalletTreeStateTest (BitcoinTestFramework):
# Tx 1 will change the treestate while Tx 2 containing chained joinsplits is still being generated
recipients = []
recipients.append({"address": self.nodes[2].z_getnewaddress(), "amount": Decimal('10.0') - DEFAULT_FEE})
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
myopid = self.nodes[0].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
wait_and_assert_operationid_status(self.nodes[0], myopid)
# Tx 2 will consume all three notes, which must take at least two joinsplits. This is regardless of

View File

@ -25,6 +25,10 @@ class WalletZSendmanyTest(BitcoinTestFramework):
def setup_network(self, split=False):
self.nodes = start_nodes(3, self.options.tmpdir, [[
nuparams(NU5_BRANCH_ID, 238),
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
@ -98,7 +102,7 @@ class WalletZSendmanyTest(BitcoinTestFramework):
# send node 2 taddr to zaddr
recipients = []
recipients.append({"address":myzaddr, "amount":7})
opid = self.nodes[2].z_sendmany(mytaddr, recipients)
opid = self.nodes[2].z_sendmany(mytaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedSenders')
mytxid = wait_and_assert_operationid_status(self.nodes[2], opid)
self.sync_all()
@ -152,7 +156,7 @@ class WalletZSendmanyTest(BitcoinTestFramework):
recipients.append({"address":self.nodes[0].getnewaddress(), "amount":1})
recipients.append({"address":self.nodes[2].getnewaddress(), "amount":1.0})
opid = self.nodes[2].z_sendmany(myzaddr, recipients)
opid = self.nodes[2].z_sendmany(myzaddr, recipients, 1, DEFAULT_FEE, 'AllowRevealedRecipients')
wait_and_assert_operationid_status(self.nodes[2], opid)
zbalance -= Decimal('2.0') + zsendmanyfee

View File

@ -10,7 +10,9 @@ from decimal import Decimal
# Test wallet address behaviour across network upgrades
class WalletZeroValueTest(BitcoinTestFramework):
def setup_network(self, split=False):
self.nodes = start_nodes(2, self.options.tmpdir)
self.nodes = start_nodes(2, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * 2)
connect_nodes_bi(self.nodes,0,1)
self.is_network_split=False
self.sync_all()

View File

@ -64,7 +64,11 @@ class WalletBackupTest(BitcoinTestFramework):
ed2 = "-exportdir=" + self.options.tmpdir + "/node2"
# nodes 1, 2,3 are spenders, let's give them a keypool=100
extra_args = [["-keypool=100", ed0], ["-keypool=100", ed1], ["-keypool=100", ed2], []]
base_args = [
"-keypool=100",
"-allowdeprecated=getnewaddress",
]
extra_args = [base_args + [ed0], base_args + [ed1], base_args + [ed2], []]
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
connect_nodes(self.nodes[0], 3)
connect_nodes(self.nodes[1], 3)
@ -97,7 +101,8 @@ class WalletBackupTest(BitcoinTestFramework):
self.sync_all()
# As above, this mirrors the original bash test.
def start_three(self, extra_args=None):
def start_three(self, extra_args=[]):
extra_args = extra_args + ["-allowdeprecated=getnewaddress"]
self.nodes[0] = start_node(0, self.options.tmpdir, extra_args)
self.nodes[1] = start_node(1, self.options.tmpdir, extra_args)
self.nodes[2] = start_node(2, self.options.tmpdir, extra_args)

View File

@ -18,7 +18,9 @@ class ZapWalletTXesTest (BitcoinTestFramework):
self.num_nodes = 3
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
]] * self.num_nodes)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)

View File

@ -23,7 +23,12 @@ class ZkeyImportExportTest (BitcoinTestFramework):
initialize_chain_clean(self.options.tmpdir, 5)
def setup_network(self, split=False):
self.nodes = start_nodes(5, self.options.tmpdir)
self.nodes = start_nodes(5, self.options.tmpdir, extra_args=[[
'-allowdeprecated=getnewaddress',
'-allowdeprecated=z_getnewaddress',
'-allowdeprecated=z_getbalance',
'-allowdeprecated=z_gettotalbalance',
]] * 5)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
@ -118,7 +123,7 @@ class ZkeyImportExportTest (BitcoinTestFramework):
verify_utxos(charlie, amounts[:4], ipk_zaddr["address"])
# address is Sapling
assert_equal(ipk_zaddr["type"], "sapling")
assert_equal(ipk_zaddr["address_type"], "sapling")
# Verify idempotent behavior:
ipk_zaddr2 = charlie.z_importkey(bob_privkey)

View File

@ -29,7 +29,11 @@ class ZMQTest(BitcoinTestFramework):
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % self.port)
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[
['-zmqpubhashtx=tcp://127.0.0.1:'+str(self.port), '-zmqpubhashblock=tcp://127.0.0.1:'+str(self.port)],
[
'-zmqpubhashtx=tcp://127.0.0.1:'+str(self.port),
'-zmqpubhashblock=tcp://127.0.0.1:'+str(self.port),
'-allowdeprecated=getnewaddress',
],
[],
[],
[]

View File

@ -26,6 +26,13 @@ static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
// Wallet-level features
#ifdef ENABLE_WALLET
#endif
}};
static const std::set<std::string> DEFAULT_DENY_DEPRECATED{{
// Node-level features
// Wallet-level features
#ifdef ENABLE_WALLET
"legacy_privacy",
"getnewaddress",
"getrawchangeaddress",
@ -37,10 +44,6 @@ static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
"wallettxvjoinsplit"
#endif
}};
static const std::set<std::string> DEFAULT_DENY_DEPRECATED{{
#ifdef ENABLE_WALLET
#endif
}};
// Flags that enable deprecated functionality.
#ifdef ENABLE_WALLET

View File

@ -5,6 +5,7 @@
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
#include "clientversion.h"
#include "deprecation.h"
#include "init.h"
#include "key_io.h"
#include "experimental_features.h"
@ -220,10 +221,17 @@ UniValue validateaddress(const UniValue& params, bool fHelp)
class DescribePaymentAddressVisitor
{
void pushAddressType(UniValue& obj, std::string address_type) const {
obj.pushKV("address_type", address_type);
if (fEnableAddrTypeField) {
obj.pushKV("type", address_type); //deprecated
}
}
public:
UniValue operator()(const CKeyID &addr) const {
UniValue obj(UniValue::VOBJ);
obj.pushKV("type", "p2pkh");
pushAddressType(obj, "p2pkh");
#ifdef ENABLE_WALLET
if (pwalletMain) {
obj.pushKV("ismine", pwalletMain->HaveKey(addr));
@ -234,7 +242,7 @@ public:
UniValue operator()(const CScriptID &addr) const {
UniValue obj(UniValue::VOBJ);
obj.pushKV("type", "p2sh");
pushAddressType(obj, "p2sh");
#ifdef ENABLE_WALLET
if (pwalletMain) {
obj.pushKV("ismine", pwalletMain->HaveCScript(addr));
@ -245,7 +253,7 @@ public:
UniValue operator()(const libzcash::SproutPaymentAddress &zaddr) const {
UniValue obj(UniValue::VOBJ);
obj.pushKV("type", "sprout");
pushAddressType(obj, "sprout");
obj.pushKV("payingkey", zaddr.a_pk.GetHex());
obj.pushKV("transmissionkey", zaddr.pk_enc.GetHex());
#ifdef ENABLE_WALLET
@ -258,7 +266,7 @@ public:
UniValue operator()(const libzcash::SaplingPaymentAddress &zaddr) const {
UniValue obj(UniValue::VOBJ);
obj.pushKV("type", "sapling");
pushAddressType(obj, "sapling");
obj.pushKV("diversifier", HexStr(zaddr.d));
obj.pushKV("diversifiedtransmissionkey", zaddr.pk_d.GetHex());
#ifdef ENABLE_WALLET
@ -271,7 +279,7 @@ public:
UniValue operator()(const libzcash::UnifiedAddress &uaddr) const {
UniValue obj(UniValue::VOBJ);
obj.pushKV("type", "unified");
pushAddressType(obj, "unified");
// TODO: More information.
return obj;
}
@ -289,7 +297,8 @@ UniValue z_validateaddress(const UniValue& params, bool fHelp)
"{\n"
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
" \"address\" : \"addr\", (string) The address validated\n"
" \"type\" : \"xxxx\", (string) \"p2pkh\", \"p2sh\", \"sprout\" or \"sapling\"\n"
" \"address_type\" : \"xxxx\", (string) \"p2pkh\", \"p2sh\", \"sprout\" or \"sapling\"\n"
" \"type\" : \"xxxx\", (string) \"p2pkh\", \"p2sh\", \"sprout\" or \"sapling\" (DEPRECATED, legacy attribute)\n"
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
" \"payingkey\" : \"hex\", (string) [sprout] The hex value of the paying key, a_pk\n"
" \"transmissionkey\" : \"hex\", (string) [sprout] The hex value of the transmission key, pk_enc\n"