Skip to content

Commit 78b06a4

Browse files
laanwjvijaydasmp
authored andcommitted
Merge 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
1 parent 96685be commit 78b06a4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/interfaces/wallet.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
#include <util/message.h>
1515
#include <util/ui_change_type.h>
1616

17+
#include <cstdint>
1718
#include <functional>
1819
#include <map>
1920
#include <memory>
2021
#include <psbt.h>
21-
#include <stdint.h>
2222
#include <string>
2323
#include <tuple>
24+
#include <type_traits>
2425
#include <utility>
2526
#include <vector>
2627

@@ -37,7 +38,7 @@ struct CRecipient;
3738
struct PartiallySignedTransaction;
3839
struct WalletContext;
3940
struct bilingual_str;
40-
typedef uint8_t isminefilter;
41+
using isminefilter = std::underlying_type<isminetype>::type;
4142

4243
namespace interfaces {
4344

src/wallet/ismine.h

+4-4
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)