From a3a4d199e298a76725d0c0424195ae54c7e95fe0 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Thu, 21 Nov 2024 16:04:56 +0100 Subject: [PATCH] refactor: deduplicate anchor witness program bytes (`0x4e,0x73`) Co-authored-by: Gregory Sanders --- src/addresstype.h | 7 +++++-- src/test/script_standard_tests.cpp | 6 ++---- src/test/transaction_tests.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/addresstype.h b/src/addresstype.h index 93cdf66c5b..09f3063c61 100644 --- a/src/addresstype.h +++ b/src/addresstype.h @@ -117,10 +117,13 @@ public: } }; +/** Witness program for Pay-to-Anchor output script type */ +static const std::vector anchor_bytes{0x4e, 0x73}; + struct PayToAnchor : public WitnessUnknown { - PayToAnchor() : WitnessUnknown(1, {0x4e, 0x73}) { - Assume(CScript::IsPayToAnchor(1, {0x4e, 0x73})); + PayToAnchor() : WitnessUnknown(1, anchor_bytes) { + Assume(CScript::IsPayToAnchor(1, anchor_bytes)); }; }; diff --git a/src/test/script_standard_tests.cpp b/src/test/script_standard_tests.cpp index ff7c98f7fe..3d3822542a 100644 --- a/src/test/script_standard_tests.cpp +++ b/src/test/script_standard_tests.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include