|
35 | 35 | import virtualchain |
36 | 36 | log = virtualchain.get_logger("blockstack-log") |
37 | 37 |
|
| 38 | +IMPORT_HEIGHT=665750 |
| 39 | + |
38 | 40 | def get_virtual_chain_name(): |
39 | 41 | """ |
40 | 42 | (required by virtualchain state engine) |
@@ -204,12 +206,11 @@ def db_parse( block_id, txid, vtxindex, op, data, senders, inputs, outputs, fee, |
204 | 206 | if not check_tx_sender_types(senders, block_id): |
205 | 207 | log.warning('Invalid senders for {}'.format(txid)) |
206 | 208 | return None |
207 | | - |
| 209 | + |
208 | 210 | # check if the v2 export threshold block has already been reached. |
209 | 211 | # 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)) |
213 | 214 | return None |
214 | 215 |
|
215 | 216 | # 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_ |
587 | 588 | # check if the ID threshold block has already been reached |
588 | 589 | threshold_block_id = db_state.get_v2_upgrade_threshold_block() |
589 | 590 | 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: |
596 | 594 | 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') |
599 | 600 |
|
600 | 601 | else: |
601 | 602 | # check if threshold is reached at current block height |
|
0 commit comments