Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same input envelopes become reinscriptions #2478

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading