Skip to content

Commit

Permalink
util: move util/message to common/signmessage
Browse files Browse the repository at this point in the history
Move util/message to common/signmessage so it is named more clearly, and
because the util library is not supposed to depend on other libraries besides
the crypto library. The signmessage functions use CKey, CPubKey, PKHash, and
DecodeDestination functions in the consensus and common libraries.
  • Loading branch information
ryanofsky committed May 16, 2024
1 parent cc5f29f commit 6861f95
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ BITCOIN_CORE_H = \
compat/cpuid.h \
compat/endian.h \
common/settings.h \
common/signmessage.h \
common/system.h \
compressor.h \
consensus/consensus.h \
Expand Down Expand Up @@ -308,7 +309,6 @@ BITCOIN_CORE_H = \
util/hasher.h \
util/insert.h \
util/macros.h \
util/message.h \
util/moneystr.h \
util/overflow.h \
util/overloaded.h \
Expand Down Expand Up @@ -680,6 +680,7 @@ libbitcoin_common_a_SOURCES = \
common/interfaces.cpp \
common/run_command.cpp \
common/settings.cpp \
common/signmessage.cpp \
common/system.cpp \
common/url.cpp \
compressor.cpp \
Expand Down Expand Up @@ -742,7 +743,6 @@ libbitcoin_util_a_SOURCES = \
util/hasher.cpp \
util/sock.cpp \
util/syserror.cpp \
util/message.cpp \
util/moneystr.cpp \
util/rbf.cpp \
util/readwritefile.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/util/message.cpp → src/common/signmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <common/signmessage.h>
#include <hash.h>
#include <key.h>
#include <key_io.h>
#include <pubkey.h>
#include <uint256.h>
#include <util/message.h>
#include <util/strencodings.h>

#include <cassert>
Expand Down
6 changes: 3 additions & 3 deletions src/util/message.h → src/common/signmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_UTIL_MESSAGE_H
#define BITCOIN_UTIL_MESSAGE_H
#ifndef BITCOIN_COMMON_SIGNMESSAGE_H
#define BITCOIN_COMMON_SIGNMESSAGE_H

#include <uint256.h>

Expand Down Expand Up @@ -74,4 +74,4 @@ uint256 MessageHash(const std::string& message);

std::string SigningResultString(const SigningResult res);

#endif // BITCOIN_UTIL_MESSAGE_H
#endif // BITCOIN_COMMON_SIGNMESSAGE_H
2 changes: 1 addition & 1 deletion src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#define BITCOIN_INTERFACES_WALLET_H

#include <addresstype.h>
#include <common/signmessage.h>
#include <consensus/amount.h>
#include <interfaces/chain.h>
#include <pubkey.h>
#include <script/script.h>
#include <support/allocators/secure.h>
#include <util/fs.h>
#include <util/message.h>
#include <util/result.h>
#include <util/ui_change_type.h>

Expand Down
2 changes: 1 addition & 1 deletion src/qt/signverifymessagedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include <qt/platformstyle.h>
#include <qt/walletmodel.h>

#include <common/signmessage.h> // For MessageSign(), MessageVerify()
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <key_io.h>
#include <util/message.h> // For MessageSign(), MessageVerify()
#include <wallet/wallet.h>

#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/signmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <common/signmessage.h>
#include <key.h>
#include <key_io.h>
#include <rpc/protocol.h>
#include <rpc/request.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <univalue.h>
#include <util/message.h>

#include <string>

Expand Down
2 changes: 1 addition & 1 deletion src/test/fuzz/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <chainparams.h>
#include <common/signmessage.h>
#include <key_io.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <util/chaintype.h>
#include <util/message.h>
#include <util/strencodings.h>

#include <cassert>
Expand Down
2 changes: 1 addition & 1 deletion src/test/util_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <clientversion.h>
#include <common/signmessage.h> // For MessageSign(), MessageVerify(), MESSAGE_MAGIC
#include <hash.h> // For Hash()
#include <key.h> // For CKey
#include <sync.h>
Expand All @@ -12,7 +13,6 @@
#include <util/bitdeque.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/message.h> // For MessageSign(), MessageVerify(), MESSAGE_MAGIC
#include <util/moneystr.h>
#include <util/overflow.h>
#include <util/readwritefile.h>
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpc/signmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <common/signmessage.h>
#include <key_io.h>
#include <rpc/util.h>
#include <util/message.h>
#include <wallet/rpc/util.h>
#include <wallet/wallet.h>

Expand Down
2 changes: 1 addition & 1 deletion src/wallet/scriptpubkeyman.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#define BITCOIN_WALLET_SCRIPTPUBKEYMAN_H

#include <addresstype.h>
#include <common/signmessage.h>
#include <logging.h>
#include <psbt.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <util/error.h>
#include <util/message.h>
#include <util/result.h>
#include <util/time.h>
#include <wallet/crypter.h>
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <coins.h>
#include <common/args.h>
#include <common/settings.h>
#include <common/signmessage.h>
#include <common/system.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
Expand Down Expand Up @@ -52,7 +53,6 @@
#include <util/error.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/message.h>
#include <util/moneystr.h>
#include <util/result.h>
#include <util/string.h>
Expand Down

0 comments on commit 6861f95

Please sign in to comment.