Skip to content

Commit

Permalink
Same input envelopes become reinscriptions (#2478)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph authored Oct 2, 2023
1 parent db7016c commit 6654f09
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
30 changes: 20 additions & 10 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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);

Expand All @@ -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 {
Expand All @@ -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!(
Expand Down
4 changes: 1 addition & 3 deletions src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit 6654f09

Please sign in to comment.