mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
miniscript: mark nodes with duplicate keys as insane
As stated on the website, duplicate keys make it hard to reason about malleability as a single signature may unlock multiple paths. We use a custom KeyCompare function instead of operator< to be explicit about the requirement.
This commit is contained in:
@@ -47,6 +47,10 @@ struct TestData {
|
||||
struct ParserContext {
|
||||
typedef CPubKey Key;
|
||||
|
||||
bool KeyCompare(const Key& a, const Key& b) const {
|
||||
return a < b;
|
||||
}
|
||||
|
||||
std::optional<std::string> ToString(const Key& key) const
|
||||
{
|
||||
auto it = TEST_DATA.dummy_key_idx_map.find(key);
|
||||
@@ -90,6 +94,10 @@ struct ScriptParserContext {
|
||||
std::vector<unsigned char> data;
|
||||
};
|
||||
|
||||
bool KeyCompare(const Key& a, const Key& b) const {
|
||||
return a.data < b.data;
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& ToPKBytes(const Key& key) const
|
||||
{
|
||||
assert(!key.is_hash);
|
||||
|
||||
Reference in New Issue
Block a user