@@ -1639,6 +1639,8 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
1639
1639
1640
1640
for ( tx_index, new_tx) in block. transactions . iter_mut ( ) . skip ( 1 ) . enumerate ( ) {
1641
1641
let mut ordinals_events_indexes_to_discard = VecDeque :: new ( ) ;
1642
+ let mut ordinals_events_indexes_to_curse = VecDeque :: new ( ) ;
1643
+
1642
1644
// Have a new inscription been revealed, if so, are looking at a re-inscription
1643
1645
for ( ordinal_event_index, ordinal_event) in
1644
1646
new_tx. metadata . ordinal_operations . iter_mut ( ) . enumerate ( )
@@ -1649,7 +1651,7 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
1649
1651
OrdinalOperation :: InscriptionTransferred ( _) => continue ,
1650
1652
} ;
1651
1653
1652
- let inscription_number = if is_cursed {
1654
+ let mut inscription_number = if is_cursed {
1653
1655
latest_cursed_inscription_number = if !latest_cursed_inscription_loaded {
1654
1656
latest_cursed_inscription_loaded = true ;
1655
1657
match find_latest_cursed_inscription_number_at_block_height (
@@ -1749,16 +1751,35 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
1749
1751
find_inscription_with_ordinal_number ( & traversal. ordinal_number , & transaction, & ctx)
1750
1752
{
1751
1753
ctx. try_log ( |logger| {
1752
- slog :: warn !(
1754
+ info ! (
1753
1755
logger,
1754
1756
"Transaction {} in block {} is overriding an existing inscription {}" ,
1755
1757
new_tx. transaction_identifier. hash,
1756
1758
block. block_identifier. index,
1757
1759
traversal. ordinal_number
1758
1760
) ;
1759
1761
} ) ;
1760
- ordinals_events_indexes_to_discard. push_front ( ordinal_event_index) ;
1761
- continue ;
1762
+
1763
+ inscription_number = if !latest_cursed_inscription_loaded {
1764
+ latest_cursed_inscription_loaded = true ;
1765
+ match find_latest_cursed_inscription_number_at_block_height (
1766
+ & block. block_identifier . index ,
1767
+ & inscription_height_hint. cursed ,
1768
+ & transaction,
1769
+ & ctx,
1770
+ ) ? {
1771
+ None => -1 ,
1772
+ Some ( inscription_number) => inscription_number - 1 ,
1773
+ }
1774
+ } else {
1775
+ latest_cursed_inscription_number - 1
1776
+ } ;
1777
+ inscription. curse_type = Some ( OrdinalInscriptionCurseType :: Reinscription ) ;
1778
+
1779
+ if !is_cursed {
1780
+ ordinals_events_indexes_to_curse. push_front ( ordinal_event_index) ;
1781
+ latest_blessed_inscription_number += 1 ;
1782
+ }
1762
1783
}
1763
1784
1764
1785
inscription. inscription_number = inscription_number;
@@ -1782,6 +1803,27 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
1782
1803
storage_updated = true ;
1783
1804
}
1784
1805
1806
+ for index in ordinals_events_indexes_to_curse. into_iter ( ) {
1807
+ match new_tx. metadata . ordinal_operations . remove ( index) {
1808
+ OrdinalOperation :: InscriptionRevealed ( inscription_data)
1809
+ | OrdinalOperation :: CursedInscriptionRevealed ( inscription_data) => {
1810
+ ctx. try_log ( |logger| {
1811
+ slog:: info!(
1812
+ logger,
1813
+ "Inscription {} (#{}) transitioned from blessed to cursed" ,
1814
+ inscription_data. inscription_id,
1815
+ inscription_data. inscription_number,
1816
+ ) ;
1817
+ } ) ;
1818
+ new_tx. metadata . ordinal_operations . insert (
1819
+ index,
1820
+ OrdinalOperation :: CursedInscriptionRevealed ( inscription_data) ,
1821
+ ) ;
1822
+ }
1823
+ _ => unreachable ! ( ) ,
1824
+ }
1825
+ }
1826
+
1785
1827
for index in ordinals_events_indexes_to_discard. into_iter ( ) {
1786
1828
new_tx. metadata . ordinal_operations . remove ( index) ;
1787
1829
}
0 commit comments