payment key test passes! adding options to renew as well

This commit is contained in:
Aaron Blankstein
2017-09-08 11:46:32 -04:00
parent c006610f75
commit efa72f98f1
3 changed files with 26 additions and 12 deletions

View File

@@ -1364,7 +1364,8 @@ def transfer(fqu, transfer_address, prior_name_data = None, config_path=CONFIG_P
# RPC method: backend_renew
def renew( fqu, renewal_fee, config_path=CONFIG_PATH, proxy=None ):
def renew(fqu, renewal_fee, config_path=CONFIG_PATH, proxy=None, owner_key = None,
payment_key = None):
"""
Renew a name
@@ -1387,10 +1388,12 @@ def renew( fqu, renewal_fee, config_path=CONFIG_PATH, proxy=None ):
resp = None
payment_privkey_info = get_wallet_payment_privkey_info(config_path=config_path, proxy=proxy)
owner_privkey_info = get_wallet_owner_privkey_info(config_path=config_path, proxy=proxy)
if payment_key is None:
payment_key = get_wallet_payment_privkey_info(config_path=config_path, proxy=proxy)
if owner_key is None:
owner_key = get_wallet_owner_privkey_info(config_path=config_path, proxy=proxy)
resp = async_renew(fqu, owner_privkey_info, payment_privkey_info, renewal_fee,
resp = async_renew(fqu, owner_key, payment_key, renewal_fee,
proxy=proxy,
config_path=config_path,
queue_path=state.queue_path)

View File

@@ -4321,13 +4321,14 @@ class BlockstackAPIEndpointClient(object):
return self.get_response(req)
def backend_renew(self, fqu, renewal_fee):
def backend_renew(self, fqu, renewal_fee, owner_key = None, payment_key = None):
"""
Queue a renewal
"""
if is_api_server(self.config_dir):
# directly invoke the renew
return backend.registrar.renew(fqu, renewal_fee, config_path=self.config_path)
return backend.registrar.renew(fqu, renewal_fee, config_path=self.config_path,
owner_key = owner_key, payment_key = payment_key)
else:
res = self.check_version()
@@ -4339,6 +4340,12 @@ class BlockstackAPIEndpointClient(object):
'name': fqu,
}
if owner_key is not None:
data['owner_key'] = owner_key
if payment_key is not None:
data['payment_key'] = payment_key
headers = self.make_request_headers()
req = requests.post( 'http://{}:{}/v1/names'.format(self.server, self.port), data=json.dumps(data), timeout=self.timeout, headers=headers)
return self.get_response(req)