Skip to content

Commit 77c4254

Browse files
authored
Merge pull request #2314 from blockstack/feat/hardcode-export-ht
Hardcode export height to 665750
2 parents 33890e4 + 3b31cbc commit 77c4254

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

blockstack/lib/nameset/virtualchain_hooks.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import virtualchain
3636
log = virtualchain.get_logger("blockstack-log")
3737

38+
IMPORT_HEIGHT=665750
39+
3840
def get_virtual_chain_name():
3941
"""
4042
(required by virtualchain state engine)
@@ -204,12 +206,11 @@ def db_parse( block_id, txid, vtxindex, op, data, senders, inputs, outputs, fee,
204206
if not check_tx_sender_types(senders, block_id):
205207
log.warning('Invalid senders for {}'.format(txid))
206208
return None
207-
209+
208210
# check if the v2 export threshold block has already been reached.
209211
# if so, then no more transactions will be considered
210-
v2_block_id = db_state.get_v2_import_block_reached()
211-
if v2_block_id is not None:
212-
log.warning("V2 export block height threshold reached; ignoring transaction {}".format(data.encode('hex')))
212+
if block_id >= IMPORT_HEIGHT:
213+
log.warning("V2 export block height threshold ({}) reached; ignoring transaction {} @ {}".format(IMPORT_HEIGHT, data.encode('hex'), block_id))
213214
return None
214215

215216
# this virtualchain instance must give the 'raw_tx' hint
@@ -587,15 +588,15 @@ def db_save( block_height, consensus_hash, ops_hash, accepted_ops, virtualchain_
587588
# check if the ID threshold block has already been reached
588589
threshold_block_id = db_state.get_v2_upgrade_threshold_block()
589590
if threshold_block_id is not None:
590-
import_block = db_state.get_v2_import_block_reached()
591-
if import_block is None:
592-
# check if the required number of blocks have been mined since threshold crossed
593-
if (block_height - threshold_block_id == v2_upgrade_signal_import_threshold):
594-
# emit parsable log entry and export datafile
595-
log.warn('[v2-upgrade] import threshold reached at block: {}'.format(block_height))
591+
if block_height == IMPORT_HEIGHT:
592+
import_block = db_state.get_v2_import_block_reached()
593+
if import_block is None:
596594
db_state.set_v2_import_block_reached(block_height)
597-
db_state.perform_v2_upgrade_datafile_export(block_height, consensus_hash)
598-
log.warn('[v2-upgrade] migration datafile export successful')
595+
596+
# emit parsable log entry and export datafile
597+
log.warn('[v2-upgrade] import threshold reached at block: {}'.format(block_height))
598+
db_state.perform_v2_upgrade_datafile_export(block_height, consensus_hash)
599+
log.warn('[v2-upgrade] migration datafile export successful')
599600

600601
else:
601602
# check if threshold is reached at current block height

0 commit comments

Comments
 (0)