Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion blockstack/blockstackd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ def export_account_state(self, account_state):
"""
Make an account state presentable to external consumers
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcnelson @kantai this location for a patch was not intuitive for me. There was another area that made more sense, but found this after some local testing. Please confirm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @jcnelson has the most context on the appropriate place to apply this. Alternatively, you can catch the forwarding that happens in api/server.py and rewrite the lock time there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this change will do is alter what is (a) returned by the RESTful API and (b) what is returned by blockstack/lib/client.py. If that's what you want, then this is fine. I think it's more appropriate to do it here than in api/server.py.

return {
result = {
'address': account_state['address'],
'type': account_state['type'],
'credit_value': '{}'.format(account_state['credit_value']),
Expand All @@ -1433,6 +1433,7 @@ def export_account_state(self, account_state):
'vtxindex': account_state['vtxindex'],
'txid': account_state['txid'],
}
return result


def rpc_get_account_record(self, address, token_type, **con_info):
Expand All @@ -1451,11 +1452,17 @@ def rpc_get_account_record(self, address, token_type, **con_info):

db = get_db_state(self.working_dir)
account = db.get_account(address, token_type)
last_block = db.lastblock
db.close()

if account is None:
return {'error': 'No such account', 'http_status': 404}

# if block height is after the migration export threshold, return a lock height that will force the wallet to error when sending a tx
if last_block >= virtualchain_hooks.IMPORT_HEIGHT:
print log.warning('[v2-upgrade] Forcing lock_transfer_block_id to 9999999 to prevent wallet txs')
account['lock_transfer_block_id'] = 9999999

state = self.export_account_state(account)
return self.success_response({'account': state})

Expand Down