Skip to content

Commit 8b4dc94

Browse files
committed
Merge bitcoin/bitcoin#27117: fuzz: avoid redundant dup key checks when creating Miniscript nodes
c1b7bd0 fuzz: avoid redundant dup key checks when creating Miniscript nodes (Antoine Poinsot) Pull request description: I thought i had done that already in #24149, but it must have slipped through the rebase. It's a 2x speed improvement against the existing corpora and will probably be much more as we extend them with larger nodes. ACKs for top commit: sipa: ACK c1b7bd0 Tree-SHA512: 9e6ceb6254183964b6c5538e21ba6321df95a68acb343a15a6ecfef5c51a1980d2627df5aeef9aef1db41656e18cc4f3bc96e6f24314d12fa60368b04a350001
2 parents 0c57920 + c1b7bd0 commit 8b4dc94

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/fuzz/miniscript.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ using Type = miniscript::Type;
253253
using miniscript::operator"" _mst;
254254

255255
//! Construct a miniscript node as a shared_ptr.
256-
template<typename... Args> NodeRef MakeNodeRef(Args&&... args) { return miniscript::MakeNodeRef<CPubKey>(KEY_COMP, std::forward<Args>(args)...); }
256+
template<typename... Args> NodeRef MakeNodeRef(Args&&... args) {
257+
return miniscript::MakeNodeRef<CPubKey>(miniscript::internal::NoDupCheck{}, std::forward<Args>(args)...);
258+
}
257259

258260
/** Information about a yet to be constructed Miniscript node. */
259261
struct NodeInfo {
@@ -762,6 +764,7 @@ NodeRef GenNode(F ConsumeNode, Type root_type = ""_mst, bool strict_valid = fals
762764
}
763765
}
764766
assert(stack.size() == 1);
767+
stack[0]->DuplicateKeyCheck(KEY_COMP);
765768
return std::move(stack[0]);
766769
}
767770

0 commit comments

Comments
 (0)