From 75648cea5a9032b3d388cbebacb94d908e08924e Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Tue, 30 Jul 2024 14:01:19 -0400 Subject: [PATCH] test: add P2A ProduceSignature coverage --- src/test/script_tests.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 0d309469ef379..d1ea723501b45 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -1277,6 +1277,19 @@ BOOST_AUTO_TEST_CASE(sign_invalid_miniscript) BOOST_CHECK(!SignSignature(keystore, CTransaction(prev), curr, 0, SIGHASH_ALL, sig_data)); } +/* P2A input should be considered signed. */ +BOOST_AUTO_TEST_CASE(sign_paytoanchor) +{ + FillableSigningProvider keystore; + SignatureData sig_data; + CMutableTransaction prev, curr; + prev.vout.emplace_back(0, GetScriptForDestination(PayToAnchor{})); + + curr.vin.emplace_back(COutPoint{prev.GetHash(), 0}); + + BOOST_CHECK(SignSignature(keystore, CTransaction(prev), curr, 0, SIGHASH_ALL, sig_data)); +} + BOOST_AUTO_TEST_CASE(script_standard_push) { ScriptError err;