Skip to content

Commit

Permalink
[bitcoin] temporary pause the ordinals protocol (#2679)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar authored Sep 24, 2024
1 parent 6e1a4f7 commit b3fda0b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
9 changes: 9 additions & 0 deletions frameworks/bitcoin-move/doc/bitcoin.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ The reorg is too deep, we need to stop the system and fix the issue



<a name="0x4_bitcoin_ORDINAL_PAUSE_HEIGHT"></a>



<pre><code><b>const</b> <a href="bitcoin.md#0x4_bitcoin_ORDINAL_PAUSE_HEIGHT">ORDINAL_PAUSE_HEIGHT</a>: u64 = 861150;
</code></pre>



<a name="0x4_bitcoin_genesis_init"></a>

## Function `genesis_init`
Expand Down
25 changes: 15 additions & 10 deletions frameworks/bitcoin-move/sources/bitcoin.move
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module bitcoin_move::bitcoin{
/// https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki
const BIP_34_HEIGHT:u64 = 227835;

const ORDINALS_PAUSE_HEIGHT:u64 = 861150;

struct UTXONotExistsEvent has copy, drop{
outpoint: OutPoint,
}
Expand Down Expand Up @@ -162,16 +164,19 @@ module bitcoin_move::bitcoin{

idx = idx + 1;
};

let seal_outs = bitcoin_move::inscription_updater::process_tx(pending_block, tx, &mut input_utxos);
let seal_outs_len = vector::length(&seal_outs);
if (seal_outs_len > 0) {
let seal_out_idx = 0;
while (seal_out_idx < seal_outs_len) {
let seal_out = vector::pop_back(&mut seal_outs);
let (output_index, utxo_seal) = utxo::unpack_seal_out(seal_out);
simple_multimap::add(&mut output_seals, output_index, utxo_seal);
seal_out_idx = seal_out_idx + 1;
//temporary pause the ordinals process for the performance reason
let skip_ordinals = block_height >= ORDINALS_PAUSE_HEIGHT && network::is_mainnet() && rooch_framework::chain_id::is_main();
if(!skip_ordinals){
let seal_outs = bitcoin_move::inscription_updater::process_tx(pending_block, tx, &mut input_utxos);
let seal_outs_len = vector::length(&seal_outs);
if (seal_outs_len > 0) {
let seal_out_idx = 0;
while (seal_out_idx < seal_outs_len) {
let seal_out = vector::pop_back(&mut seal_outs);
let (output_index, utxo_seal) = utxo::unpack_seal_out(seal_out);
simple_multimap::add(&mut output_seals, output_index, utxo_seal);
seal_out_idx = seal_out_idx + 1;
};
};
};

Expand Down

0 comments on commit b3fda0b

Please sign in to comment.