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)

View File

@@ -242,6 +242,7 @@ def scenario( wallets, **kw ):
# make zonefile for recipients
zonefiles = []
postages = []
for i in [1,2,3]:
name = "tricky{}.test".format(i)
driver_urls = blockstack_client.storage.make_mutable_data_urls(name, use_only=['dht', 'disk'])
@@ -356,18 +357,19 @@ def check( state_engine ):
print "wrong namespace"
return False
names = ['foo.test', 'bar.test', 'tricky1.test', 'tricky2.test', 'tricky3.test']
owners = [ wallets[3].addr , new_addr, new_addr, new_addr, new_addr ]
names = [ 'bar.test', 'tricky1.test', 'tricky2.test', 'tricky3.test']
owners = [ new_addr ] * 4
payers = [ wallets[1].addr ] * 4
test_proxy = testlib.TestAPIProxy()
for i in xrange(0, len(names)):
name = names[i]
wallet_payer = 5
wallet_owner = 3 + i
wallet_data_pubkey = 4
# not preordered
preorder = state_engine.get_name_preorder( name, pybitcoin.make_pay_to_address_script(wallets[wallet_payer].addr), wallets[wallet_owner].addr )
preorder = state_engine.get_name_preorder(
name, pybitcoin.make_pay_to_address_script(payers[i]), owners[i])
if preorder is not None:
print "still have preorder"
return False
@@ -383,4 +385,6 @@ def check( state_engine ):
print "name {} has wrong owner".format(name)
return False
print name_rec
return True