mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
wallet: Replace use of purpose strings with an enum
Instead of storing and passing around fixed strings for the purpose of an address, use an enum. This also rationalizes the CAddressBookData struct, documenting all fields and making them public, and simplifying the representation to avoid bugs like https://github.com/bitcoin/bitcoin/pull/26761#discussion_r1134615114 and make it not possible to invalid address data like change addresses with labels. Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
@@ -71,6 +71,10 @@ class WalletLabelsTest(BitcoinTestFramework):
|
||||
node = self.nodes[0]
|
||||
assert_equal(len(node.listunspent()), 0)
|
||||
|
||||
self.log.info("Checking listlabels' invalid parameters")
|
||||
assert_raises_rpc_error(-8, "Invalid 'purpose' argument, must be a known purpose string, typically 'send', or 'receive'.", node.listlabels, "notavalidpurpose")
|
||||
assert_raises_rpc_error(-8, "Invalid 'purpose' argument, must be a known purpose string, typically 'send', or 'receive'.", node.listlabels, "unknown")
|
||||
|
||||
# Note each time we call generate, all generated coins go into
|
||||
# the same address, so we call twice to get two addresses w/50 each
|
||||
self.generatetoaddress(node, nblocks=1, address=node.getnewaddress(label='coinbase'))
|
||||
|
||||
Reference in New Issue
Block a user