Skip to content

Commit 014cae2

Browse files
committed
Merge bitcoin/bitcoin#23591: refactor: Use underlying type of isminetype for isminefilter
fa2c991 refactor: Use underlying type of isminetype for isminefilter (MarcoFalke) Pull request description: This does not change behavior, but it would be good for code clarity and to avoid `-Wimplicit-int-conversion` compiler warnings to use the an int of the same width for both `isminetype` and `isminefilter`. ACKs for top commit: laanwj: Code review ACK fa2c991 shaavan: crACK fa2c991 promag: Code review ACK fa2c991. Tree-SHA512: b3e255de7c9b1dea272bc8cb9386b339fe701f18580e03e997c270cac6453088ca2032e26e39f536d66cd1b6fda3e96bdbdc6e960879030e635338d0916277e6
2 parents b4f647f + fa2c991 commit 014cae2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/interfaces/wallet.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
#include <util/message.h>
1414
#include <util/ui_change_type.h>
1515

16+
#include <cstdint>
1617
#include <functional>
1718
#include <map>
1819
#include <memory>
19-
#include <stdint.h>
2020
#include <string>
2121
#include <tuple>
22+
#include <type_traits>
2223
#include <utility>
2324
#include <vector>
2425

@@ -34,7 +35,7 @@ struct CRecipient;
3435
struct PartiallySignedTransaction;
3536
struct WalletContext;
3637
struct bilingual_str;
37-
typedef uint8_t isminefilter;
38+
using isminefilter = std::underlying_type<isminetype>::type;
3839

3940
namespace interfaces {
4041

src/wallet/ismine.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
#include <script/standard.h>
1010

11-
#include <stdint.h>
1211
#include <bitset>
12+
#include <cstdint>
13+
#include <type_traits>
1314

1415
class CWallet;
1516
class CScript;
@@ -35,8 +36,7 @@ class CScript;
3536
* ISMINE_USED: the scriptPubKey corresponds to a used address owned by the wallet user.
3637
*
3738
*/
38-
enum isminetype : unsigned int
39-
{
39+
enum isminetype : unsigned int {
4040
ISMINE_NO = 0,
4141
ISMINE_WATCH_ONLY = 1 << 0,
4242
ISMINE_SPENDABLE = 1 << 1,
@@ -46,7 +46,7 @@ enum isminetype : unsigned int
4646
ISMINE_ENUM_ELEMENTS,
4747
};
4848
/** used for bitflags of isminetype */
49-
typedef uint8_t isminefilter;
49+
using isminefilter = std::underlying_type<isminetype>::type;
5050

5151
/**
5252
* Cachable amount subdivided into watchonly and spendable parts.

0 commit comments

Comments
 (0)