Skip to content

Commit f5baa3f

Browse files
committed
Remove invalid BRC20 inscription tracking feature
1 parent f9b93bc commit f5baa3f

File tree

7 files changed

+5
-62
lines changed

7 files changed

+5
-62
lines changed

src/index.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ pub(crate) enum Statistic {
125125
OkxIndexBitmap = 19,
126126
OkxIndexBTCDomain = 20,
127127
OkxSaveInscriptionReceipts = 21,
128-
OkxNoTrackingInvalidBrc20Inscriptions = 22,
129128
}
130129

131130
impl Statistic {
@@ -249,7 +248,6 @@ pub struct Index {
249248
index_bitmap: bool,
250249
index_btc_domain: bool,
251250
save_inscription_receipts: bool,
252-
disable_invalid_brc20_tracking: bool,
253251
}
254252

255253
impl Index {
@@ -428,12 +426,6 @@ impl Index {
428426
u64::from(settings.index_brc20()),
429427
)?;
430428

431-
Self::set_statistic(
432-
&mut statistics,
433-
Statistic::OkxNoTrackingInvalidBrc20Inscriptions,
434-
u64::from(settings.disable_invalid_brc20_tracking()),
435-
)?;
436-
437429
Self::set_statistic(
438430
&mut statistics,
439431
Statistic::OkxSaveInscriptionReceipts,
@@ -517,7 +509,6 @@ impl Index {
517509
let index_bitmap;
518510
let index_btc_domain;
519511
let save_inscription_receipts;
520-
let disable_invalid_brc20_tracking;
521512

522513
{
523514
let tx = database.begin_read()?;
@@ -529,10 +520,6 @@ impl Index {
529520
index_transactions = Self::is_statistic_set(&statistics, Statistic::IndexTransactions)?;
530521

531522
index_brc20 = Self::is_statistic_set(&statistics, Statistic::OkxIndexBrc20)?;
532-
disable_invalid_brc20_tracking = Self::is_statistic_set(
533-
&statistics,
534-
Statistic::OkxNoTrackingInvalidBrc20Inscriptions,
535-
)?;
536523

537524
index_bitmap = Self::is_statistic_set(&statistics, Statistic::OkxIndexBitmap)?;
538525
index_btc_domain = Self::is_statistic_set(&statistics, Statistic::OkxIndexBTCDomain)?;
@@ -578,7 +565,6 @@ impl Index {
578565
index_bitmap,
579566
index_btc_domain,
580567
save_inscription_receipts,
581-
disable_invalid_brc20_tracking,
582568
})
583569
}
584570
pub(crate) fn with_metrics(mut self) -> Self {

src/index/bundle_message.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@ pub struct BundleMessage {
3838
pub inscription_action: InscriptionAction,
3939
}
4040

41-
impl BundleMessage {
42-
/// Determines whether this inscription needs to be tracked.
43-
/// Returns `false` when the message is a BRC20 Mint or Transfer, otherwise `true`.
44-
pub fn should_track(&self, index: &Index) -> bool {
45-
if !index.disable_invalid_brc20_tracking {
46-
return true;
47-
}
48-
49-
if let InscriptionAction::Created { sub_type, .. } = &self.inscription_action {
50-
if let Some(SubType::BRC20(operation)) = sub_type {
51-
return !matches!(
52-
operation,
53-
BRC20Operation::Mint { .. } | BRC20Operation::InscribeTransfer(_)
54-
);
55-
}
56-
}
57-
true
58-
}
59-
}
60-
6141
impl BundleMessage {
6242
pub(in crate::index) fn from_okx_inscription_event(
6343
event: OkxInscriptionEvent,

src/index/updater/inscription_updater.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,6 @@ impl InscriptionUpdater<'_, '_> {
595595
.or_insert(UtxoEntryBuf::empty(index))
596596
});
597597

598-
let mut should_tracking_inscription = true;
599-
600598
// input_script_buf will only have a valid value when index_addresses is true.
601599
if index.index_addresses {
602600
let event = OkxInscriptionEvent {
@@ -632,8 +630,6 @@ impl InscriptionUpdater<'_, '_> {
632630
};
633631

634632
if let Some(message) = BundleMessage::from_okx_inscription_event(event, self.height, index)? {
635-
// We should decide whether to track the inscription based on the message.
636-
should_tracking_inscription = message.should_track(index);
637633
self
638634
.block_bundle_messages
639635
.entry(message.txid)
@@ -642,10 +638,7 @@ impl InscriptionUpdater<'_, '_> {
642638
}
643639
}
644640

645-
// If we are tracking the inscription, we need to push the inscription into the output UTXO entry.
646-
if should_tracking_inscription {
647-
output_utxo_entry.push_inscription(sequence_number, satpoint.offset, index);
648-
}
641+
output_utxo_entry.push_inscription(sequence_number, satpoint.offset, index);
649642

650643
Ok(())
651644
}

src/okx/brc20/fixed_point.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl FixedPoint {
2727
#[cfg(test)]
2828
const MIN: Self = Self { value: 0, scale: 0 };
2929

30+
#[allow(unused)]
3031
pub fn new(value: u128, scale: u8) -> Result<Self, NumParseError> {
3132
if scale > Self::MAX_SCALE {
3233
return Err(NumParseError::OutOfMaxScale(i64::from(scale)));

src/okx/composite_key.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ pub struct CompositeKey<T, U> {
9494
}
9595

9696
impl<T: Clone, U> CompositeKey<T, U> {
97+
98+
#[allow(unused)]
9799
pub fn primary_left_endpoint(&self) -> Endpoint<T> {
98100
Endpoint::Left(self.primary.clone())
99101
}
100102

103+
#[allow(unused)]
101104
pub fn primary_right_endpoint(&self) -> Endpoint<T> {
102105
Endpoint::Right(self.primary.clone())
103106
}

src/options.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,4 @@ pub struct Options {
101101
pub(crate) index_btc_domain: bool,
102102
#[arg(long, help = "Index BRC-20 token operations.")]
103103
pub(crate) index_brc20: bool,
104-
#[arg(
105-
long,
106-
help = "Disable tracking of invalid BRC-20 inscriptions. [default: false]"
107-
)]
108-
pub(crate) disable_invalid_brc20_tracking: bool,
109104
}

src/settings.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub struct Settings {
3535
index_bitmap: bool,
3636
index_btc_domain: bool,
3737
index_brc20: bool,
38-
disable_invalid_brc20_tracking: bool,
3938
}
4039

4140
impl Settings {
@@ -156,8 +155,6 @@ impl Settings {
156155
index_bitmap: self.index_bitmap || source.index_bitmap,
157156
index_btc_domain: self.index_btc_domain || source.index_btc_domain,
158157
index_brc20: self.index_brc20 || source.index_brc20,
159-
disable_invalid_brc20_tracking: self.disable_invalid_brc20_tracking
160-
|| source.disable_invalid_brc20_tracking,
161158
}
162159
}
163160

@@ -201,7 +198,6 @@ impl Settings {
201198
index_bitmap: options.index_bitmap,
202199
index_btc_domain: options.index_btc_domain,
203200
index_brc20: options.index_brc20,
204-
disable_invalid_brc20_tracking: options.disable_invalid_brc20_tracking,
205201
}
206202
}
207203

@@ -299,7 +295,6 @@ impl Settings {
299295
index_bitmap: get_bool("INDEX_BITMAP"),
300296
index_btc_domain: get_bool("INDEX_BTC_DOMAIN"),
301297
index_brc20: get_bool("INDEX_BRC20"),
302-
disable_invalid_brc20_tracking: get_bool("DISABLE_INVALID_BRC20_TRACKING"),
303298
})
304299
}
305300

@@ -337,7 +332,6 @@ impl Settings {
337332
index_bitmap: false,
338333
index_btc_domain: false,
339334
index_brc20: false,
340-
disable_invalid_brc20_tracking: false,
341335
}
342336
}
343337

@@ -419,7 +413,6 @@ impl Settings {
419413
index_bitmap: self.index_bitmap,
420414
index_btc_domain: self.index_btc_domain,
421415
index_brc20: self.index_brc20,
422-
disable_invalid_brc20_tracking: self.disable_invalid_brc20_tracking,
423416
})
424417
}
425418

@@ -654,10 +647,6 @@ impl Settings {
654647
self.index_brc20
655648
}
656649

657-
pub(crate) fn disable_invalid_brc20_tracking(&self) -> bool {
658-
self.disable_invalid_brc20_tracking
659-
}
660-
661650
pub(crate) fn index_bitmap(&self) -> bool {
662651
self.index_bitmap
663652
}
@@ -1144,7 +1133,6 @@ mod tests {
11441133
("INDEX_BITMAP", "1"),
11451134
("INDEX_BTC_DOMAIN", "1"),
11461135
("INDEX_BRC20", "1"),
1147-
("DISABLE_INVALID_BRC20_TRACKING", "1"),
11481136
]
11491137
.into_iter()
11501138
.map(|(key, value)| (key.into(), value.into()))
@@ -1195,7 +1183,6 @@ mod tests {
11951183
index_bitmap: true,
11961184
index_btc_domain: true,
11971185
index_brc20: true,
1198-
disable_invalid_brc20_tracking: true,
11991186
}
12001187
);
12011188
}
@@ -1234,7 +1221,6 @@ mod tests {
12341221
"--index-bitmap",
12351222
"--index-btc-domain",
12361223
"--index-brc20",
1237-
"--disable-invalid-brc20-tracking",
12381224
])
12391225
.unwrap()
12401226
),
@@ -1270,7 +1256,6 @@ mod tests {
12701256
index_bitmap: true,
12711257
index_btc_domain: true,
12721258
index_brc20: true,
1273-
disable_invalid_brc20_tracking: true,
12741259
}
12751260
);
12761261
}

0 commit comments

Comments
 (0)