Skip to content

Commit

Permalink
Disable inscriptions on mainnet (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Nov 17, 2022
1 parent 3dc90b6 commit ecade4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fn encode_satpoint(satpoint: SatPoint) -> [u8; 44] {

pub(crate) struct Index {
auth: Auth,
chain: Chain,
client: Client,
database: Database,
database_path: PathBuf,
Expand Down Expand Up @@ -161,6 +162,7 @@ impl Index {
Ok(Self {
genesis_block_coinbase_txid: genesis_block_coinbase_transaction.txid(),
auth,
chain: options.chain,
client,
database,
database_path,
Expand Down
21 changes: 13 additions & 8 deletions src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use {super::*, std::sync::mpsc};

pub struct Updater {
cache: HashMap<[u8; 36], Vec<u8>>,
outputs_traversed: u64,
outputs_cached: u64,
chain: Chain,
height: u64,
ordinal_ranges_since_flush: u64,
outputs_cached: u64,
outputs_inserted_since_flush: u64,
height: u64,
outputs_traversed: u64,
}

impl Updater {
Expand All @@ -23,11 +24,12 @@ impl Updater {

let mut updater = Self {
cache: HashMap::new(),
outputs_traversed: 0,
chain: index.chain,
height,
ordinal_ranges_since_flush: 0,
outputs_cached: 0,
outputs_inserted_since_flush: 0,
ordinal_ranges_since_flush: 0,
height,
outputs_traversed: 0,
};

updater.update_index(index, wtx)
Expand Down Expand Up @@ -290,8 +292,11 @@ impl Updater {
ordinal_ranges_written: &mut u64,
outputs_traversed: &mut u64,
) -> Result {
if let Some((ordinal, inscription)) = Inscription::from_transaction(tx, input_ordinal_ranges) {
ordinal_to_inscription.insert(&ordinal.n(), &inscription.0)?;
if self.chain != Chain::Mainnet {
if let Some((ordinal, inscription)) = Inscription::from_transaction(tx, input_ordinal_ranges)
{
ordinal_to_inscription.insert(&ordinal.n(), &inscription.0)?;
}
}

for (vout, output) in tx.output.iter().enumerate() {
Expand Down

0 comments on commit ecade4c

Please sign in to comment.