ordinals / ord

👁‍🗨 Rare and exotic sats
https://ordinals.com
Creative Commons Zero v1.0 Universal
3.81k stars 1.35k forks source link

Annex detection incorrect #2052

Closed casey closed 1 year ago

casey commented 1 year ago

Our taproot annex detection code looks wrong. It is currently:

    let script = witness
      .iter()
      .nth(if annex {
        witness.len() - 1
      } else {
        witness.len() - 2
      })
      .unwrap();

But it should be:

    let script = witness
      .iter()
      .nth(if annex {
        witness.len() - 3
      } else {
        witness.len() - 2
      })
      .unwrap();

Id est, if the annex is present, we look one more element back for the script.

panicfarm commented 1 year ago

You should prob use tapscript() from bitcoin::blockdata::witness::Witness