Skip to content

Commit

Permalink
Merge #19331: build: Do not include server symbols in wallet
Browse files Browse the repository at this point in the history
faca730 ci: Install fixed version of clang-format for linters (MarcoFalke)
fa4695d build: Sort Makefile.am after renaming file (MarcoFalke)
cccc278 scripted-diff: Move ui_interface to the node lib (MarcoFalke)
fa72ca6 qt: Remove unused includes (MarcoFalke)
fac96e6 wallet: Do not include server symbols (MarcoFalke)
fa0f6c5 Revert "Fix link error with --enable-debug" (MarcoFalke)

Pull request description:

  This reverts a hacky workaround from commit b83cc0f, which only happens to work due to compiler optimizations. Then, it actually fixes the linker error.

  The underlying problem is that the wallet includes symbols from the server (ui_interface), which usually results in linker failures. Though, in this specific case the linker failures have not been observed (unless `-O0`) because our compilers were smart enough to strip unused symbols.

  Fix the underlying problem by creating a new header-only with the needed symbol and move ui_interface to node to clarify that this is part of libbitcoin_server.

ACKs for top commit:
  Sjors:
    ACK faca730
  laanwj:
    ACK faca730
  hebasto:
    re-ACK faca730, since the [previous](bitcoin/bitcoin#19331 (review)) review:

Tree-SHA512: e9731f249425aaea50b6db5fc7622e10078cf006721bb87989cac190a2ff224412f6f8a7dd83efd018835302337611f5839e29e15bef366047ed591cef58dfb4
  • Loading branch information
laanwj authored and knst committed Jan 9, 2024
1 parent e9fc767 commit 8698bae
Show file tree
Hide file tree
Showing 34 changed files with 68 additions and 60 deletions.
4 changes: 4 additions & 0 deletions ci/lint/04_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

export LC_ALL=C

travis_retry sudo apt update && sudo apt install -y clang-format-9
sudo update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-9 ) 100
sudo update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(which clang-format-diff-9) 100

travis_retry pip3 install codespell==1.17.1
travis_retry pip3 install flake8==3.8.3
travis_retry pip3 install vulture==2.3
Expand Down
35 changes: 18 additions & 17 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ BITCOIN_CORE_H = \
cachemap.h \
cachemultimap.h \
blockfilter.h \
bloom.h \
chain.h \
chainparams.h \
chainparamsbase.h \
Expand Down Expand Up @@ -170,6 +171,7 @@ BITCOIN_CORE_H = \
cuckoocache.h \
ctpl_stl.h \
cxxtimer.hpp \
dbwrapper.h \
deploymentinfo.h \
deploymentstatus.h \
evo/assetlocktx.h \
Expand Down Expand Up @@ -217,7 +219,6 @@ BITCOIN_CORE_H = \
interfaces/wallet.h \
key.h \
key_io.h \
dbwrapper.h \
limitedmap.h \
llmq/blockprocessor.h \
llmq/chainlocks.h \
Expand Down Expand Up @@ -263,6 +264,7 @@ BITCOIN_CORE_H = \
node/context.h \
node/psbt.h \
node/transaction.h \
node/ui_interface.h \
node/utxo_snapshot.h \
noui.h \
outputtype.h \
Expand Down Expand Up @@ -308,13 +310,12 @@ BITCOIN_CORE_H = \
support/lockedpool.h \
sync.h \
timestampindex.h \
threadsafety.h \
threadinterrupt.h \
threadsafety.h \
timedata.h \
torcontrol.h \
txdb.h \
txmempool.h \
ui_interface.h \
undo.h \
unordered_lru_cache.h \
util/bip32.h \
Expand All @@ -329,8 +330,6 @@ BITCOIN_CORE_H = \
util/hasher.h \
util/hash_type.h \
util/irange.h \
util/spanparsing.h \
util/system.h \
util/asmap.h \
util/getuniquepath.h \
util/macros.h \
Expand All @@ -345,20 +344,22 @@ BITCOIN_CORE_H = \
util/ranges_set.h \
util/sock.h \
util/string.h \
util/spanparsing.h \
util/system.h \
util/time.h \
util/thread.h \
util/threadnames.h \
util/trace.h \
util/translation.h \
util/vector.h \
util/ui_change_type.h \
util/url.h \
util/vector.h \
validation.h \
validationinterface.h \
versionbits.h \
walletinitinterface.h \
wallet/bdb.h \
wallet/coincontrol.h \
wallet/coinselection.h \
wallet/context.h \
wallet/crypter.h \
wallet/db.h \
Expand All @@ -373,7 +374,7 @@ BITCOIN_CORE_H = \
wallet/walletdb.h \
wallet/wallettool.h \
wallet/walletutil.h \
wallet/coinselection.h \
walletinitinterface.h \
warnings.h \
zmq/zmqabstractnotifier.h \
zmq/zmqnotificationinterface.h \
Expand Down Expand Up @@ -423,6 +424,14 @@ libbitcoin_server_a_SOURCES = \
evo/specialtx.cpp \
evo/specialtxman.cpp \
flatfile.cpp \
governance/classes.cpp \
governance/exceptions.cpp \
governance/governance.cpp \
governance/object.cpp \
governance/validators.cpp \
governance/vote.cpp \
governance/votedb.cpp \
gsl/assert.cpp \
httprpc.cpp \
httpserver.cpp \
i2p.cpp \
Expand All @@ -431,14 +440,6 @@ libbitcoin_server_a_SOURCES = \
index/coinstatsindex.cpp \
index/txindex.cpp \
init.cpp \
governance/governance.cpp \
governance/classes.cpp \
governance/exceptions.cpp \
governance/object.cpp \
governance/validators.cpp \
governance/vote.cpp \
governance/votedb.cpp \
gsl/assert.cpp \
llmq/quorums.cpp \
llmq/blockprocessor.cpp \
llmq/commitment.cpp \
Expand Down Expand Up @@ -472,6 +473,7 @@ libbitcoin_server_a_SOURCES = \
node/interfaces.cpp \
node/psbt.cpp \
node/transaction.cpp \
node/ui_interface.cpp \
noui.cpp \
policy/fees.cpp \
policy/policy.cpp \
Expand All @@ -497,7 +499,6 @@ libbitcoin_server_a_SOURCES = \
torcontrol.cpp \
txdb.cpp \
txmempool.cpp \
ui_interface.cpp \
validation.cpp \
validationinterface.cpp \
versionbits.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/banman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <banman.h>

#include <netaddress.h>
#include <ui_interface.h>
#include <node/ui_interface.h>
#include <util/system.h>
#include <util/time.h>
#include <util/translation.h>
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <init.h>
#include <interfaces/chain.h>
#include <node/context.h>
#include <node/ui_interface.h>
#include <noui.h>
#include <shutdown.h>
#include <ui_interface.h>
#include <util/check.h>
#include <util/system.h>
#include <util/strencodings.h>
Expand Down
1 change: 0 additions & 1 deletion src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <consensus/validation.h>
#include <deploymentstatus.h>
#include <script/standard.h>
#include <ui_interface.h>
#include <validation.h>
#include <validationinterface.h>
#include <univalue.h>
Expand Down
2 changes: 1 addition & 1 deletion src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

#include <chainparamsbase.h>
#include <netbase.h>
#include <node/ui_interface.h>
#include <rpc/protocol.h> // For HTTP status codes
#include <shutdown.h>
#include <sync.h>
#include <ui_interface.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <util/threadnames.h>
Expand Down
2 changes: 1 addition & 1 deletion src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <chainparams.h>
#include <index/base.h>
#include <node/blockstorage.h>
#include <node/ui_interface.h>
#include <shutdown.h>
#include <tinyformat.h>
#include <ui_interface.h>
#include <util/thread.h>
#include <util/translation.h>
#include <validation.h> // For g_chainman
Expand Down
2 changes: 1 addition & 1 deletion src/index/txindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <index/disktxpos.h>
#include <index/txindex.h>
#include <node/ui_interface.h>
#include <shutdown.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/translation.h>
#include <validation.h>
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <netbase.h>
#include <node/blockstorage.h>
#include <node/context.h>
#include <node/ui_interface.h>
#include <policy/feerate.h>
#include <policy/fees.h>
#include <policy/policy.h>
Expand All @@ -54,7 +55,6 @@
#include <torcontrol.h>
#include <txdb.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <util/asmap.h>
#include <util/error.h>
#include <util/moneystr.h>
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation)
#include <script/standard.h> // For CTxDestination
#include <support/allocators/secure.h> // For SecureString
#include <ui_interface.h> // For ChangeType
#include <util/message.h>
#include <util/ui_change_type.h>

#include <functional>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <masternode/sync.h>
#include <net_processing.h>
#include <node/blockstorage.h>
#include <node/ui_interface.h>
#include <scheduler.h>
#include <spork.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <util/thread.h>
#include <util/time.h>
#include <validation.h>
Expand Down
2 changes: 1 addition & 1 deletion src/masternode/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <governance/governance.h>
#include <netfulfilledman.h>
#include <netmessagemaker.h>
#include <node/ui_interface.h>
#include <shutdown.h>
#include <ui_interface.h>
#include <validation.h>
#include <util/time.h>
#include <util/translation.h>
Expand Down
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include <net_permissions.h>
#include <netaddress.h>
#include <netbase.h>
#include <node/ui_interface.h>
#include <protocol.h>
#include <random.h>
#include <scheduler.h>
#include <ui_interface.h>
#include <util/sock.h>
#include <util/strencodings.h>
#include <util/thread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/node/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <node/blockstorage.h>
#include <node/coin.h>
#include <node/context.h>
#include <node/ui_interface.h>
#include <node/transaction.h>
#include <policy/feerate.h>
#include <policy/fees.h>
Expand All @@ -44,7 +45,6 @@
#include <sync.h>
#include <timedata.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <uint256.h>
#include <util/check.h>
#include <util/system.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ui_interface.cpp → src/node/ui_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <ui_interface.h>
#include <node/ui_interface.h>

#include <util/translation.h>

Expand Down
16 changes: 4 additions & 12 deletions src/ui_interface.h → src/node/ui_interface.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_UI_INTERFACE_H
#define BITCOIN_UI_INTERFACE_H
#ifndef BITCOIN_NODE_UI_INTERFACE_H
#define BITCOIN_NODE_UI_INTERFACE_H

#include <functional>
#include <memory>
Expand All @@ -21,14 +21,6 @@ class connection;
}
} // namespace boost

/** General change type (added, updated, removed). */
enum ChangeType
{
CT_NEW,
CT_UPDATED,
CT_DELETED
};

/** Signals for UI communication. */
class CClientUIInterface
{
Expand Down Expand Up @@ -132,8 +124,8 @@ void InitWarning(const bilingual_str& str);

/** Show error message **/
bool InitError(const bilingual_str& str);
inline bool AbortError(const bilingual_str& str) { return InitError(str); }
constexpr auto AbortError = InitError;

extern CClientUIInterface uiInterface;

#endif // BITCOIN_UI_INTERFACE_H
#endif // BITCOIN_NODE_UI_INTERFACE_H
2 changes: 1 addition & 1 deletion src/noui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <noui.h>

#include <logging.h>
#include <ui_interface.h>
#include <node/ui_interface.h>
#include <util/translation.h>

#include <string>
Expand Down
1 change: 0 additions & 1 deletion src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <node/context.h>
#include <noui.h>
#include <stacktraces.h>
#include <ui_interface.h>
#include <uint256.h>
#include <util/system.h>
#include <util/threadnames.h>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#include <interfaces/coinjoin.h>
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <node/ui_interface.h>
#include <qt/governancelist.h>
#include <qt/masternodelist.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/translation.h>

Expand Down
1 change: 0 additions & 1 deletion src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <protocol.h>
#include <script/script.h>
#include <script/standard.h>
#include <ui_interface.h>
#include <util/system.h>

#include <cmath>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/paymentserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <chainparams.h>
#include <clientversion.h>
#include <interfaces/node.h>
#include <policy/policy.h>
#include <key_io.h>
#include <ui_interface.h>
#include <node/ui_interface.h>
#include <policy/policy.h>
#include <util/system.h>

#include <cstdlib>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include <chainparams.h>
#include <interfaces/node.h>
#include <key_io.h>
#include <node/ui_interface.h>
#include <policy/fees.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <wallet/wallet.h>
Expand Down
1 change: 0 additions & 1 deletion src/qt/splashscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <qt/guiutil.h>
#include <qt/networkstyle.h>
#include <qt/walletmodel.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/translation.h>

Expand Down
Loading

0 comments on commit 8698bae

Please sign in to comment.