Skip to content

Commit

Permalink
refactor: move BIP39 related code to wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Jan 31, 2024
1 parent c4bee58 commit 50c3494
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ BITCOIN_CORE_H = \
base58.h \
batchedlogger.h \
bech32.h \
bip39.h \
bip39_english.h \
blockencodings.h \
bloom.h \
cachemap.h \
Expand Down Expand Up @@ -363,6 +361,8 @@ BITCOIN_CORE_H = \
validationinterface.h \
versionbits.h \
wallet/bdb.h \
wallet/bip39.h \
wallet/bip39_english.h \
wallet/coincontrol.h \
wallet/coinselection.h \
wallet/context.h \
Expand Down Expand Up @@ -538,6 +538,7 @@ libbitcoin_wallet_a_SOURCES = \
coinjoin/client.cpp \
coinjoin/interfaces.cpp \
coinjoin/util.cpp \
wallet/bip39.cpp \
wallet/coincontrol.cpp \
wallet/context.cpp \
wallet/crypter.cpp \
Expand Down Expand Up @@ -706,7 +707,6 @@ libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_common_a_SOURCES = \
base58.cpp \
bech32.cpp \
bip39.cpp \
bloom.cpp \
chainparams.cpp \
coins.cpp \
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ FUZZ_SUITE_LD_COMMON = \
$(LIBTEST_FUZZ) \
$(LIBTEST_UTIL) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBBITCOIN_WALLET) \
$(LIBBITCOIN_CRYPTO) \
$(LIBBITCOIN_CLI) \
$(LIBDASHBLS) \
$(BDB_LIBS) \
Expand Down Expand Up @@ -83,7 +83,6 @@ BITCOIN_TESTS =\
test/base64_tests.cpp \
test/bech32_tests.cpp \
test/bip32_tests.cpp \
test/bip39_tests.cpp \
test/block_reward_reallocation_tests.cpp \
test/blockchain_tests.cpp \
test/blockencodings_tests.cpp \
Expand Down Expand Up @@ -179,6 +178,7 @@ BITCOIN_TESTS =\

if ENABLE_WALLET
BITCOIN_TESTS += \
wallet/test/bip39_tests.cpp \
wallet/test/coinjoin_tests.cpp \
wallet/test/psbt_wallet_tests.cpp \
wallet/test/wallet_tests.cpp \
Expand Down
4 changes: 2 additions & 2 deletions src/bip39.cpp → src/wallet/bip39.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
// Source:
// https://github.com/trezor/trezor-crypto

#include <bip39.h>
#include <bip39_english.h>
#include <wallet/bip39.h>
#include <wallet/bip39_english.h>
#include <crypto/pkcs5_pbkdf2_hmac_sha512.h>
#include <crypto/sha256.h>
#include <random.h>
Expand Down
6 changes: 3 additions & 3 deletions src/bip39.h → src/wallet/bip39.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef BITCOIN_BIP39_H
#define BITCOIN_BIP39_H
#ifndef BITCOIN_WALLET_BIP39_H
#define BITCOIN_WALLET_BIP39_H

#include <support/allocators/secure.h>

Expand All @@ -36,4 +36,4 @@ class CMnemonic
static void ToSeed(SecureString mnemonic, SecureString passphrase, SecureVector& seedRet);
};

#endif // BITCOIN_BIP39_H
#endif // BITCOIN_WALLET_BIP39_H
6 changes: 3 additions & 3 deletions src/bip39_english.h → src/wallet/bip39_english.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef BITCOIN_BIP39_ENGLISH_H
#define BITCOIN_BIP39_ENGLISH_H
#ifndef BITCOIN_WALLET_BIP39_ENGLISH_H
#define BITCOIN_WALLET_BIP39_ENGLISH_H

const char * const wordlist[] = {
"abandon",
Expand Down Expand Up @@ -2076,4 +2076,4 @@ const char * const wordlist[] = {
0,
};

#endif // BITCOIN_BIP39_ENGLISH_H
#endif // BITCOIN_WALLET_BIP39_ENGLISH_H
2 changes: 1 addition & 1 deletion src/wallet/hdchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <wallet/hdchain.h>

#include <bip39.h>
#include <wallet/bip39.h>
#include <chainparams.h>
#include <key_io.h>
#include <tinyformat.h>
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
#ifdef USE_BDB
#include <wallet/bdb.h>
#endif
#include <wallet/bip39.h>
#include <wallet/coincontrol.h>
#include <wallet/hdchain.h>
#include <wallet/wallet.h>
#include <walletinitinterface.h>

#include <bip39.h>
#include <coinjoin/client.h>
#include <coinjoin/options.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <test/data/bip39_vectors.json.h>

#include <bip39.h>
#include <wallet/bip39.h>
#include <key.h>
#include <key_io.h>
#include <test/util/setup_common.h>
Expand Down

0 comments on commit 50c3494

Please sign in to comment.