@@ -261,8 +261,6 @@ template<typename... Args> NodeRef MakeNodeRef(Args&&... args) {
261
261
struct NodeInfo {
262
262
// ! The type of this node
263
263
Fragment fragment;
264
- // ! Number of subs of this node
265
- uint8_t n_subs;
266
264
// ! The timelock value for older() and after(), the threshold value for multi() and thresh()
267
265
uint32_t k;
268
266
// ! Keys for this node, if it has some
@@ -272,15 +270,13 @@ struct NodeInfo {
272
270
// ! The type requirements for the children of this node.
273
271
std::vector<Type> subtypes;
274
272
275
- NodeInfo (Fragment frag): fragment(frag), n_subs(0 ), k(0 ) {}
276
- NodeInfo (Fragment frag, CPubKey key): fragment(frag), n_subs(0 ), k(0 ), keys({key}) {}
277
- NodeInfo (Fragment frag, uint32_t _k): fragment(frag), n_subs(0 ), k(_k) {}
278
- NodeInfo (Fragment frag, std::vector<unsigned char > h): fragment(frag), n_subs(0 ), k(0 ), hash(std::move(h)) {}
279
- NodeInfo (uint8_t subs, Fragment frag): fragment(frag), n_subs(subs), k(0 ), subtypes(subs, " " _mst) {}
280
- NodeInfo (uint8_t subs, Fragment frag, uint32_t _k): fragment(frag), n_subs(subs), k(_k), subtypes(subs, " " _mst) {}
281
- NodeInfo (std::vector<Type> subt, Fragment frag): fragment(frag), n_subs(subt.size()), k(0 ), subtypes(std::move(subt)) {}
282
- NodeInfo (std::vector<Type> subt, Fragment frag, uint32_t _k): fragment(frag), n_subs(subt.size()), k(_k), subtypes(std::move(subt)) {}
283
- NodeInfo (Fragment frag, uint32_t _k, std::vector<CPubKey> _keys): fragment(frag), n_subs(0 ), k(_k), keys(std::move(_keys)) {}
273
+ NodeInfo (Fragment frag): fragment(frag), k(0 ) {}
274
+ NodeInfo (Fragment frag, CPubKey key): fragment(frag), k(0 ), keys({key}) {}
275
+ NodeInfo (Fragment frag, uint32_t _k): fragment(frag), k(_k) {}
276
+ NodeInfo (Fragment frag, std::vector<unsigned char > h): fragment(frag), k(0 ), hash(std::move(h)) {}
277
+ NodeInfo (std::vector<Type> subt, Fragment frag): fragment(frag), k(0 ), subtypes(std::move(subt)) {}
278
+ NodeInfo (std::vector<Type> subt, Fragment frag, uint32_t _k): fragment(frag), k(_k), subtypes(std::move(subt)) {}
279
+ NodeInfo (Fragment frag, uint32_t _k, std::vector<CPubKey> _keys): fragment(frag), k(_k), keys(std::move(_keys)) {}
284
280
};
285
281
286
282
/* * Pick an index in a collection from a single byte in the fuzzer's output. */
@@ -795,11 +791,11 @@ NodeRef GenNode(F ConsumeNode, Type root_type, bool strict_valid = false) {
795
791
NodeInfo& info = *todo.back ().second ;
796
792
// Gather children from the back of stack.
797
793
std::vector<NodeRef> sub;
798
- sub.reserve (info.n_subs );
799
- for (size_t i = 0 ; i < info.n_subs ; ++i) {
800
- sub.push_back (std::move (*(stack.end () - info.n_subs + i)));
794
+ sub.reserve (info.subtypes . size () );
795
+ for (size_t i = 0 ; i < info.subtypes . size () ; ++i) {
796
+ sub.push_back (std::move (*(stack.end () - info.subtypes . size () + i)));
801
797
}
802
- stack.erase (stack.end () - info.n_subs , stack.end ());
798
+ stack.erase (stack.end () - info.subtypes . size () , stack.end ());
803
799
// Construct new NodeRef.
804
800
NodeRef node;
805
801
if (info.keys .empty ()) {
0 commit comments