descriptor: assert we never parse a sane miniscript with no pubkey

This commit is contained in:
Antoine Poinsot 2023-06-29 11:53:03 +02:00
parent a49402a9ec
commit c7db88af71
No known key found for this signature in database
GPG key ID: E13FC145CD3F4304

View file

@ -15,6 +15,7 @@
#include <common/args.h>
#include <span.h>
#include <util/bip32.h>
#include <util/check.h>
#include <util/spanparsing.h>
#include <util/strencodings.h>
#include <util/vector.h>
@ -1566,6 +1567,9 @@ std::unique_ptr<DescriptorImpl> ParseScript(uint32_t& key_exp_index, Span<const
}
return nullptr;
}
// A signature check is required for a miniscript to be sane. Therefore no sane miniscript
// may have an empty list of public keys.
CHECK_NONFATAL(!parser.m_keys.empty());
return std::make_unique<MiniscriptDescriptor>(std::move(parser.m_keys), std::move(node));
}
}