Skip to content

Commit c815ddc

Browse files
committed
Added WitnessV1Point tests
1 parent 5f1be9a commit c815ddc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/test/script_standard_tests.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,22 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination)
221221
BOOST_CHECK(ExtractDestination(s, address));
222222
BOOST_CHECK(boost::get<WitnessV0ScriptHash>(&address) && *boost::get<WitnessV0ScriptHash>(&address) == scripthash);
223223

224+
// TX_WITNESS_V1_SCRIPTHASH
225+
s.clear();
226+
WitnessV1Point taproot(pubkey);
227+
auto modified_key = ToByteVector(pubkey);
228+
modified_key[0] -= 2;
229+
s << OP_1 << modified_key;
230+
BOOST_CHECK(ExtractDestination(s, address));
231+
BOOST_CHECK(boost::get<WitnessV1Point>(&address) && *boost::get<WitnessV1Point>(&address) == taproot);
232+
224233
// TX_WITNESS with unknown version
225234
s.clear();
226-
s << OP_1 << ToByteVector(pubkey);
235+
s << OP_2 << ToByteVector(pubkey);
227236
BOOST_CHECK(ExtractDestination(s, address));
228237
WitnessUnknown unk;
229238
unk.length = 33;
230-
unk.version = 1;
239+
unk.version = 2;
231240
std::copy(pubkey.begin(), pubkey.end(), unk.program);
232241
BOOST_CHECK(boost::get<WitnessUnknown>(&address) && *boost::get<WitnessUnknown>(&address) == unk);
233242
}

0 commit comments

Comments
 (0)