Repository: bitcoin/bitcoin (language: cpp)

Issue:
miniscript: comparison of integers of different signs
This is being emitted with [GCC 10.2.1](https://packages.debian.org/bullseye/g++-arm-linux-gnueabihf), in some CI jobs: i.e https://github.com/bitcoin/bitcoin/pull/25972/checks?check_run_id=12423693655, or https://github.com/bitcoin/bitcoin/pull/25972/checks?check_run_id=12423693651 (where we actually turn on all our warning flags with depends builds).
```bash
In file included from test/miniscript_tests.cpp:19:
./script/miniscript.h:1197:71: error: comparison of integers of different signs: 'typename iterator_traits<int *>::difference_type' (aka 'int') and 'const uint32_t' (aka 'const unsigned int') [-Werror,-Wsign-compare]
                    return std::count(subs.begin(), subs.end(), true) >= node.k;
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~
test/miniscript_tests.cpp:346:34: note: in instantiation of function template specialization 'miniscript::Node<CPubKey>::IsSatisfiable<(lambda at test/miniscript_tests.cpp:346:48)>' requested here
        bool satisfiable = node->IsSatisfiable([](const Node&) { return true; });
                                 ^
1 error generated.
```

cc @darosior 


Discussion / hints:
It should be fine to make the returned value of `std::count` unsigned. 
I'm on it. I'll check if there are other occurrences too, had quite a lot of them in #27255.

Fix patch:
diff --git a/src/script/miniscript.h b/src/script/miniscript.h
index bb42bf3c92d03..7c1a87a7dcf96 100644
--- a/src/script/miniscript.h
+++ b/src/script/miniscript.h
@@ -1194,7 +1194,7 @@ struct Node {
                 case Fragment::OR_I:
                     return subs[0] || subs[1];
                 case Fragment::THRESH:
-                    return std::count(subs.begin(), subs.end(), true) >= node.k;
+                    return static_cast<uint32_t>(std::count(subs.begin(), subs.end(), true)) >= node.k;
                 default: // wrappers
                     assert(subs.size() == 1);
                     return subs[0];


Test patch: