aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/miniscript.cpp
diff options
context:
space:
mode:
authorAntoine Poinsot <darosior@protonmail.com>2022-04-14 19:01:26 +0200
committerAntoine Poinsot <darosior@protonmail.com>2022-05-30 15:16:43 +0200
commit7a549c6c59e6babbae76af008433426c6fa38fe2 (patch)
tree5b4646fa4050cbb0887e1209c094c1e0df0c3f5b /src/test/fuzz/miniscript.cpp
parent8c0f8bf7bc3750fad648af1a548517a272114bca (diff)
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.
Diffstat (limited to 'src/test/fuzz/miniscript.cpp')
-rw-r--r--src/test/fuzz/miniscript.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/fuzz/miniscript.cpp b/src/test/fuzz/miniscript.cpp
index 65346a44a9..6be75322b4 100644
--- a/src/test/fuzz/miniscript.cpp
+++ b/src/test/fuzz/miniscript.cpp
@@ -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);