Skip to content

Commit 961a255

Browse files
authored
Merge pull request Blockstream#99 from mempool/mononaut/anchor-output-type
Add support for anchor output type
2 parents bffba5a + 570071a commit 961a255

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/rest.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ impl TxOutValue {
355355
"v0_p2wsh"
356356
} else if is_v1_p2tr(script) {
357357
"v1_p2tr"
358+
} else if is_anchor(script) {
359+
"anchor"
358360
} else if script.is_provably_unspendable() {
359361
"provably_unspendable"
360362
} else if is_bare_multisig(script) {
@@ -405,6 +407,15 @@ fn is_bare_multisig(script: &Script) -> bool {
405407
&& script[0] <= script[len - 2]
406408
}
407409

410+
fn is_anchor(script: &Script) -> bool {
411+
let len = script.len();
412+
len == 4
413+
&& script[0] == opcodes::all::OP_PUSHNUM_1.into_u8()
414+
&& script[1] == opcodes::all::OP_PUSHBYTES_2.into_u8()
415+
&& script[2] == 0x4e
416+
&& script[3] == 0x73
417+
}
418+
408419
#[derive(Serialize)]
409420
struct UtxoValue {
410421
txid: Txid,

0 commit comments

Comments
 (0)