Skip to content

Commit 89836a8

Browse files
committed
style: minor improvements as a followup to #19845
Address suggestions: bitcoin/bitcoin#19845 (comment) bitcoin/bitcoin#19845 (comment) bitcoin/bitcoin#19845 (comment)
1 parent ec9b449 commit 89836a8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/netaddress.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Make sure that this does not collide with any of the values in `version.h`
3030
* or with `SERIALIZE_TRANSACTION_NO_WITNESS`.
3131
*/
32-
static const int ADDRV2_FORMAT = 0x20000000;
32+
static constexpr int ADDRV2_FORMAT = 0x20000000;
3333

3434
/**
3535
* A network type.

src/test/util/setup_common.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <node/context.h>
1212
#include <pubkey.h>
1313
#include <random.h>
14+
#include <stdexcept>
1415
#include <txmempool.h>
1516
#include <util/check.h>
1617
#include <util/string.h>
@@ -158,13 +159,15 @@ std::ostream& operator<<(std::ostream& os, const uint256& num);
158159
* Use as
159160
* BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo"));
160161
*/
161-
class HasReason {
162+
class HasReason
163+
{
162164
public:
163165
explicit HasReason(const std::string& reason) : m_reason(reason) {}
164-
template <typename E>
165-
bool operator() (const E& e) const {
166+
bool operator()(const std::exception& e) const
167+
{
166168
return std::string(e.what()).find(m_reason) != std::string::npos;
167169
};
170+
168171
private:
169172
const std::string m_reason;
170173
};

0 commit comments

Comments
 (0)