@@ -300,6 +300,13 @@ BOOST_AUTO_TEST_CASE(bip340_test_vectors)
300
300
// Verify those signatures for good measure.
301
301
BOOST_CHECK (pubkey.VerifySchnorr (msg256, sig64));
302
302
303
+ // Repeat the same check, but use the KeyPair directly without any merkle tweak
304
+ KeyPair keypair = key.ComputeKeyPair (/* merkle_root=*/ nullptr );
305
+ bool kp_ok = keypair.SignSchnorr (msg256, sig64, aux256);
306
+ BOOST_CHECK (kp_ok);
307
+ BOOST_CHECK (pubkey.VerifySchnorr (msg256, sig64));
308
+ BOOST_CHECK (std::vector<unsigned char >(sig64, sig64 + 64 ) == sig);
309
+
303
310
// Do 10 iterations where we sign with a random Merkle root to tweak,
304
311
// and compare against the resulting tweaked keys, with random aux.
305
312
// In iteration i=0 we tweak with empty Merkle tree.
@@ -313,6 +320,12 @@ BOOST_AUTO_TEST_CASE(bip340_test_vectors)
313
320
bool ok = key.SignSchnorr (msg256, sig64, &merkle_root, aux256);
314
321
BOOST_CHECK (ok);
315
322
BOOST_CHECK (tweaked_key.VerifySchnorr (msg256, sig64));
323
+
324
+ // Repeat the same check, but use the KeyPair class directly
325
+ KeyPair keypair = key.ComputeKeyPair (&merkle_root);
326
+ bool kp_ok = keypair.SignSchnorr (msg256, sig64, aux256);
327
+ BOOST_CHECK (kp_ok);
328
+ BOOST_CHECK (tweaked_key.VerifySchnorr (msg256, sig64));
316
329
}
317
330
}
318
331
}
0 commit comments