From 455fca86cfada1823aa28615b5683f9dc73dbb9a Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Wed, 8 Nov 2023 14:07:49 -0500 Subject: [PATCH 1/7] policy: Add OP_1 <0x4e73> as a standard output type These outputs are called anchors, and allow key-less anchor spends which are vsize-minimized versus keyed anchors which require larger outputs when creating and inputs when spending. --- src/addresstype.cpp | 4 ++++ src/addresstype.h | 11 ++++++++++- src/key_io.cpp | 4 ++++ src/rpc/rawtransaction.cpp | 2 ++ src/rpc/util.cpp | 8 ++++++++ src/script/script.cpp | 17 +++++++++++++++++ src/script/script.h | 8 ++++++++ src/script/sign.cpp | 3 +++ src/script/solver.cpp | 4 ++++ src/script/solver.h | 1 + src/test/fuzz/script.cpp | 7 +++++-- src/test/fuzz/util.cpp | 3 +++ src/test/script_standard_tests.cpp | 26 ++++++++++++++++++++++++++ src/test/transaction_tests.cpp | 8 ++++++++ src/wallet/rpc/addresses.cpp | 1 + src/wallet/rpc/backup.cpp | 1 + src/wallet/scriptpubkeyman.cpp | 1 + 17 files changed, 106 insertions(+), 3 deletions(-) diff --git a/src/addresstype.cpp b/src/addresstype.cpp index f199d1b479446..67e643943d4da 100644 --- a/src/addresstype.cpp +++ b/src/addresstype.cpp @@ -87,6 +87,10 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) addressRet = tap; return true; } + case TxoutType::ANCHOR: { + addressRet = PayToAnchor(); + return true; + } case TxoutType::WITNESS_UNKNOWN: { addressRet = WitnessUnknown{vSolutions[0][0], vSolutions[1]}; return true; diff --git a/src/addresstype.h b/src/addresstype.h index 0152858bad2a3..93cdf66c5b17e 100644 --- a/src/addresstype.h +++ b/src/addresstype.h @@ -9,6 +9,7 @@ #include #include