From 570071a1617c6730394dde095563e7e34b4d579f Mon Sep 17 00:00:00 2001 From: Mononaut Date: Fri, 30 Aug 2024 20:11:47 +0000 Subject: [PATCH] Add support for anchor output type --- src/rest.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/rest.rs b/src/rest.rs index ce8bef96f..82dd3e68e 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -355,6 +355,8 @@ impl TxOutValue { "v0_p2wsh" } else if is_v1_p2tr(script) { "v1_p2tr" + } else if is_anchor(script) { + "anchor" } else if script.is_provably_unspendable() { "provably_unspendable" } else if is_bare_multisig(script) { @@ -405,6 +407,15 @@ fn is_bare_multisig(script: &Script) -> bool { && script[0] <= script[len - 2] } +fn is_anchor(script: &Script) -> bool { + let len = script.len(); + len == 4 + && script[0] == opcodes::all::OP_PUSHNUM_1.into_u8() + && script[1] == opcodes::all::OP_PUSHBYTES_2.into_u8() + && script[2] == 0x4e + && script[3] == 0x73 +} + #[derive(Serialize)] struct UtxoValue { txid: Txid,