Skip to content

Commit 29e4914

Browse files
committed
[Wallet][Refactor] * AddressBookData class moved to it's own addressbook file. First step towards a cleaner wallet.h/cpp file.
* AddressBookPurpose string const types created.
1 parent 5daacf8 commit 29e4914

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ BITCOIN_CORE_H = \
105105
core_io.h \
106106
crypter.h \
107107
pairresult.h \
108+
addressbook.h \
108109
denomination_functions.h \
109110
obfuscation.h \
110111
obfuscation-relay.h \

src/addressbook.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// Created by furszy on 2019-10-07.
3+
//
4+
5+
#ifndef FURSZY_PIVX_ADDRESSBOOK_H
6+
#define FURSZY_PIVX_ADDRESSBOOK_H
7+
8+
#include <map>
9+
#include <string>
10+
11+
/** Address book data */
12+
class CAddressBookData
13+
{
14+
public:
15+
16+
class AddressBookPurpose {
17+
public:
18+
inline static const std::string UNKNOWN = "unknown";
19+
inline static const std::string RECEIVE = "receive";
20+
inline static const std::string SEND = "send";
21+
inline static const std::string DELEGABLE = "delegable";
22+
inline static const std::string DELEGATOR = "delegator";
23+
};
24+
25+
std::string name;
26+
std::string purpose;
27+
28+
CAddressBookData()
29+
{
30+
purpose = AddressBookPurpose::UNKNOWN;
31+
}
32+
33+
typedef std::map<std::string, std::string> StringMap;
34+
StringMap destdata;
35+
};
36+
37+
#endif //FURSZY_PIVX_ADDRESSBOOK_H

src/wallet/wallet.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef BITCOIN_WALLET_H
99
#define BITCOIN_WALLET_H
1010

11+
#include "addressbook.h"
1112
#include "amount.h"
1213
#include "base58.h"
1314
#include "crypter.h"
@@ -147,22 +148,6 @@ class CKeyPool
147148
}
148149
};
149150

150-
/** Address book data */
151-
class CAddressBookData
152-
{
153-
public:
154-
std::string name;
155-
std::string purpose;
156-
157-
CAddressBookData()
158-
{
159-
purpose = "unknown";
160-
}
161-
162-
typedef std::map<std::string, std::string> StringMap;
163-
StringMap destdata;
164-
};
165-
166151
/**
167152
* A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
168153
* and provides the ability to create new transactions.

0 commit comments

Comments
 (0)