mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
style: minor improvements as a followup to #19845
Address suggestions: https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495486760 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495488051 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495730125
This commit is contained in:
parent
ec9b4492eb
commit
89836a82ee
2 changed files with 7 additions and 4 deletions
|
@ -29,7 +29,7 @@
|
||||||
* Make sure that this does not collide with any of the values in `version.h`
|
* Make sure that this does not collide with any of the values in `version.h`
|
||||||
* or with `SERIALIZE_TRANSACTION_NO_WITNESS`.
|
* or with `SERIALIZE_TRANSACTION_NO_WITNESS`.
|
||||||
*/
|
*/
|
||||||
static const int ADDRV2_FORMAT = 0x20000000;
|
static constexpr int ADDRV2_FORMAT = 0x20000000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A network type.
|
* A network type.
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <node/context.h>
|
#include <node/context.h>
|
||||||
#include <pubkey.h>
|
#include <pubkey.h>
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
|
#include <stdexcept>
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <util/check.h>
|
#include <util/check.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
@ -158,13 +159,15 @@ std::ostream& operator<<(std::ostream& os, const uint256& num);
|
||||||
* Use as
|
* Use as
|
||||||
* BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo"));
|
* BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo"));
|
||||||
*/
|
*/
|
||||||
class HasReason {
|
class HasReason
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
explicit HasReason(const std::string& reason) : m_reason(reason) {}
|
explicit HasReason(const std::string& reason) : m_reason(reason) {}
|
||||||
template <typename E>
|
bool operator()(const std::exception& e) const
|
||||||
bool operator() (const E& e) const {
|
{
|
||||||
return std::string(e.what()).find(m_reason) != std::string::npos;
|
return std::string(e.what()).find(m_reason) != std::string::npos;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string m_reason;
|
const std::string m_reason;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue