mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
musig: Reject empty pubkey list in GetMuSig2KeyAggCache
This commit is contained in:
@@ -18,6 +18,10 @@ constexpr uint256 MUSIG_CHAINCODE{
|
||||
|
||||
static bool GetMuSig2KeyAggCache(const std::vector<CPubKey>& pubkeys, secp256k1_musig_keyagg_cache& keyagg_cache)
|
||||
{
|
||||
if (pubkeys.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse the pubkeys
|
||||
std::vector<secp256k1_pubkey> secp_pubkeys;
|
||||
std::vector<const secp256k1_pubkey*> pubkey_ptrs;
|
||||
|
||||
@@ -89,6 +89,12 @@ BOOST_AUTO_TEST_CASE(valid_keys)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty_pubkey_list)
|
||||
{
|
||||
const std::optional<CPubKey> aggregate_pubkey{MuSig2AggregatePubkeys({})};
|
||||
BOOST_CHECK(!aggregate_pubkey.has_value());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(invalid_key)
|
||||
{
|
||||
std::vector<std::string> test_vectors = {
|
||||
|
||||
Reference in New Issue
Block a user