From 6654f09dd6e1fc2d85ece4fbbe121f7a05364fc0 Mon Sep 17 00:00:00 2001 From: raph Date: Mon, 2 Oct 2023 23:48:16 +0200 Subject: [PATCH] Same input envelopes become reinscriptions (#2478) --- src/index.rs | 30 ++++++++++++++++-------- src/index/updater/inscription_updater.rs | 4 +--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/index.rs b/src/index.rs index 268ae921a3..a03e31e376 100644 --- a/src/index.rs +++ b/src/index.rs @@ -2959,7 +2959,7 @@ mod tests { } #[test] - fn multiple_inscriptions_same_input_all_but_first_are_cursed_and_unbound() { + fn multiple_inscriptions_same_input_are_cursed_reinscriptions() { for context in Context::configurations() { context.rpc_server.mine_blocks(1); @@ -3016,19 +3016,19 @@ mod tests { context.index.assert_inscription_location( second, SatPoint { - outpoint: unbound_outpoint(), + outpoint: OutPoint { txid, vout: 0 }, offset: 0, }, - None, + Some(50 * COIN_VALUE), ); context.index.assert_inscription_location( third, SatPoint { - outpoint: unbound_outpoint(), - offset: 1, + outpoint: OutPoint { txid, vout: 0 }, + offset: 0, }, - None, + Some(50 * COIN_VALUE), ); assert_eq!( @@ -3109,8 +3109,9 @@ mod tests { }); let first = InscriptionId { txid, index: 0 }; // normal + let second = InscriptionId { txid, index: 1 }; // cursed reinscription let fourth = InscriptionId { txid, index: 3 }; // cursed but bound - let ninth = InscriptionId { txid, index: 8 }; // cursed and unbound + let ninth = InscriptionId { txid, index: 8 }; // cursed reinscription context.mine_blocks(1); @@ -3123,6 +3124,15 @@ mod tests { Some(50 * COIN_VALUE), ); + context.index.assert_inscription_location( + second, + SatPoint { + outpoint: OutPoint { txid, vout: 0 }, + offset: 0, + }, + Some(50 * COIN_VALUE), + ); + context.index.assert_inscription_location( fourth, SatPoint { @@ -3135,10 +3145,10 @@ mod tests { context.index.assert_inscription_location( ninth, SatPoint { - outpoint: unbound_outpoint(), - offset: 5, + outpoint: OutPoint { txid, vout: 0 }, + offset: 100 * COIN_VALUE, }, - None, + Some(150 * COIN_VALUE), ); assert_eq!( diff --git a/src/index/updater/inscription_updater.rs b/src/index/updater/inscription_updater.rs index 70b6a34435..2bd02387a8 100644 --- a/src/index/updater/inscription_updater.rs +++ b/src/index/updater/inscription_updater.rs @@ -223,9 +223,7 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> { curse.is_some() }; - let unbound = current_input_value == 0 - || inscription.offset != 0 - || curse == Some(Curse::UnrecognizedEvenField); + let unbound = current_input_value == 0 || curse == Some(Curse::UnrecognizedEvenField); if curse.is_some() || unbound { log::info!(