add 'createnewaddress' command, separate from getunusedaddress

This commit is contained in:
ThomasV 2017-10-11 12:07:41 +02:00
parent de85b56e0a
commit 6656154b78
1 changed files with 11 additions and 11 deletions

View File

@ -605,21 +605,21 @@ class Commands:
return list(map(self._format_request, out))
@command('w')
def getunusedaddress(self,force=False):
"""Returns the first unused address."""
addr = self.wallet.get_unused_address()
if addr is None and force:
addr = self.wallet.create_new_address(False)
if addr:
return addr
else:
return False
def createnewaddress(self):
"""Create a new receiving address, beyond the gap limit of the wallet"""
return self.wallet.create_new_address(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')
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()
if addr is None:
if force: