Skip to content

Commit a656c14

Browse files
author
Aaron Blankstein
authored
Merge pull request #2316 from blockstack/feat/v1-lock-block-post-migration
feat: set impossible lock_transfer_block_id
2 parents 77c4254 + b139c98 commit a656c14

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

blockstack/blockstackd.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ def export_account_state(self, account_state):
14231423
"""
14241424
Make an account state presentable to external consumers
14251425
"""
1426-
return {
1426+
result = {
14271427
'address': account_state['address'],
14281428
'type': account_state['type'],
14291429
'credit_value': '{}'.format(account_state['credit_value']),
@@ -1433,6 +1433,7 @@ def export_account_state(self, account_state):
14331433
'vtxindex': account_state['vtxindex'],
14341434
'txid': account_state['txid'],
14351435
}
1436+
return result
14361437

14371438

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

14521453
db = get_db_state(self.working_dir)
14531454
account = db.get_account(address, token_type)
1455+
last_block = db.lastblock
14541456
db.close()
14551457

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

1461+
# if block height is after the migration export threshold, return a lock height that will force the wallet to error when sending a tx
1462+
if last_block >= virtualchain_hooks.IMPORT_HEIGHT:
1463+
print log.warning('[v2-upgrade] Forcing lock_transfer_block_id to 9999999 to prevent wallet txs')
1464+
account['lock_transfer_block_id'] = 9999999
1465+
14591466
state = self.export_account_state(account)
14601467
return self.success_response({'account': state})
14611468

0 commit comments

Comments
 (0)