tMerge pull request #2123 from gdiepen/master - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cc852ef6a5731bb9a8e8d5ec3323aff808a42c34 DIR parent ed2db4be8047d7807e6c2cac3041d2468199961c HTML Author: ThomasV <thomasv@electrum.org> Date: Mon, 6 Mar 2017 12:32:11 +0100 Merge pull request #2123 from gdiepen/master Implemented getunusedaddress command Diffstat: M lib/commands.py | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) --- DIR diff --git a/lib/commands.py b/lib/commands.py t@@ -569,6 +569,19 @@ class Commands: return 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 + + + @command('w') def addrequest(self, amount, memo='', expiration=None, force=False): """Create a payment request.""" addr = self.wallet.get_unused_address()