Browse Source

add 'createnewaddress' command, separate from getunusedaddress

master
ThomasV 8 years ago
parent
commit
6656154b78
  1. 22
      lib/commands.py

22
lib/commands.py

@ -605,21 +605,21 @@ class Commands:
return list(map(self._format_request, out)) return list(map(self._format_request, out))
@command('w') @command('w')
def getunusedaddress(self,force=False): def createnewaddress(self):
"""Returns the first unused address.""" """Create a new receiving address, beyond the gap limit of the wallet"""
addr = self.wallet.get_unused_address() return self.wallet.create_new_address(False)
if addr is None and force:
addr = self.wallet.create_new_address(False)
if addr:
return addr
else:
return False
@command('w')
def getunusedaddress(self):
"""Returns the first unused address of the wallet, or None if all addresses are used.
An address is considered as used if it has received a transaction, or if it is used in a payment request."""
return self.wallet.get_unused_address()
@command('w') @command('w')
def addrequest(self, amount, memo='', expiration=None, force=False): def addrequest(self, amount, memo='', expiration=None, force=False):
"""Create a payment request.""" """Create a payment request, using the first unused address of the wallet.
The address will be condidered as used after this operation.
If no payment is received, the address will be considered as unused if the payment request is deleted from the wallet."""
addr = self.wallet.get_unused_address() addr = self.wallet.get_unused_address()
if addr is None: if addr is None:
if force: if force:

Loading…
Cancel
Save