Skip to content

Commit 59b2413

Browse files
19aed94 Merge bitcoin#23006: multiprocess: Add new bitcoin-gui, bitcoin-qt, bitcoin-wallet init implementations (MarcoFalke) d01f33e fix: enable namespaces for mypy while version is too old (Konstantin Akimov) 53b12e5 Merge bitcoin#23212: lint: enable mypy import checking (Konstantin Akimov) ffc9892 Merge bitcoin#23927: rpc: Pruning nodes can not fetch blocks before syncing past their height (Andrew Chow) 33f9b14 Merge bitcoin#26358: doc: Rearrange a few lines in the dependency graph of libraries (MacroFake) dcbc646 Merge bitcoin#24367: User-facing content and codebase doc fixups from transifex translator feedback (laanwj) e143ba2 partial Merge bitcoin#23521: test: refactor: dedup code by taking use of `create_block` parameters (MarcoFalke) 4736353 Merge bitcoin#23686: test: fix `interface_bitcoin_cli.py --descriptors` and add to test runner (MarcoFalke) 082e406 Merge bitcoin#23500: doc: fix typos (MarcoFalke) Pull request description: ## What was done? Regular backports from Bitcoin Core v23; have been missing or blocked till now. ## How Has This Been Tested? Run unit & functional tests ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 19aed94 Tree-SHA512: 7eb7c68ed4bda0396d2ebb7748ed5a7dd8bfc3935960b98efe8f1745c731c3b2bc12680093bf5671a4790f571e2ab86336174c93167c4afb120f821ecc426dce
2 parents ffa67f7 + 19aed94 commit 59b2413

30 files changed

+214
-79
lines changed

contrib/devtools/circular-dependencies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import sys
77
import re
8-
from multiprocess import Pool
8+
from multiprocess import Pool # type: ignore[import]
99
from typing import Dict, List, Set
1010

1111
MAPPING = {

contrib/devtools/optimize-pngs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import sys
1111
import subprocess
1212
import hashlib
13-
from PIL import Image # pip3 install Pillow
13+
# pip3 install Pillow
14+
from PIL import Image # type: ignore[import]
1415

1516
def file_hash(filename):
1617
'''Return hash of raw file contents'''

doc/design/libraries.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Note: libbitcoin_kernel is a subject to be backported & dashified.
3737

3838
```mermaid
3939
40-
%%{ init : { "flowchart" : { "curve" : "linear" }}}%%
40+
%%{ init : { "flowchart" : { "curve" : "basis" }}}%%
4141
4242
graph TD;
4343
@@ -53,18 +53,19 @@ dash-qt[dash-qt]-->libbitcoin_wallet;
5353
dash-wallet[dash-wallet]-->libbitcoin_wallet;
5454
dash-wallet[dash-wallet]-->libbitcoin_wallet_tool;
5555
56-
libbitcoin_cli-->libbitcoin_common;
5756
libbitcoin_cli-->libbitcoin_util;
57+
libbitcoin_cli-->libbitcoin_common;
5858
59-
libbitcoin_common-->libbitcoin_util;
6059
libbitcoin_common-->libdash_consensus;
60+
libbitcoin_common-->libbitcoin_util;
6161
6262
libbitcoin_kernel-->libdash_consensus;
6363
libbitcoin_kernel-->libbitcoin_util;
6464
65-
libbitcoin_node-->libbitcoin_common;
6665
libbitcoin_node-->libdash_consensus;
66+
libbitcoin_node-->libbitcoin_common;
6767
libbitcoin_node-->libbitcoin_kernel;
68+
libbitcoin_node-->libbitcoin_common;
6869
libbitcoin_node-->libbitcoin_util;
6970
7071
libbitcoinqt-->libbitcoin_common;
@@ -73,8 +74,8 @@ libbitcoinqt-->libbitcoin_util;
7374
libbitcoin_wallet-->libbitcoin_common;
7475
libbitcoin_wallet-->libbitcoin_util;
7576
76-
libbitcoin_wallet_tool-->libbitcoin_util;
7777
libbitcoin_wallet_tool-->libbitcoin_wallet;
78+
libbitcoin_wallet_tool-->libbitcoin_util;
7879
7980
classDef bold stroke-width:2px, font-weight:bold, font-size: smaller;
8081
class dash-qt,dashd,dash-cli,dash-wallet bold

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,7 @@ dash_tx_LDADD += $(BACKTRACE_LIBS) $(GMP_LIBS)
10901090

10911091
# dash-wallet binary #
10921092
dash_wallet_SOURCES = bitcoin-wallet.cpp
1093+
dash_wallet_SOURCES += init/bitcoin-wallet.cpp
10931094
dash_wallet_CPPFLAGS = $(bitcoin_bin_cppflags)
10941095
dash_wallet_CXXFLAGS = $(bitcoin_bin_cxxflags)
10951096
dash_wallet_LDFLAGS = $(bitcoin_bin_ldflags)

src/Makefile.qt.include

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,15 @@ bitcoin_qt_libtoolflags = $(AM_LIBTOOLFLAGS) --tag CXX
424424

425425
qt_dash_qt_CPPFLAGS = $(bitcoin_qt_cppflags)
426426
qt_dash_qt_CXXFLAGS = $(bitcoin_qt_cxxflags)
427-
qt_dash_qt_SOURCES = $(bitcoin_qt_sources) init/bitcoind.cpp
427+
qt_dash_qt_SOURCES = $(bitcoin_qt_sources) init/bitcoin-qt.cpp
428428
qt_dash_qt_LDADD = $(bitcoin_qt_ldadd)
429429
qt_dash_qt_LDFLAGS = $(bitcoin_qt_ldflags)
430430
qt_dash_qt_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags)
431431

432432
dash_gui_CPPFLAGS = $(bitcoin_qt_cppflags)
433433
dash_gui_CXXFLAGS = $(bitcoin_qt_cxxflags)
434-
dash_gui_SOURCES = $(bitcoin_qt_sources) init/bitcoind.cpp
435-
dash_gui_LDADD = $(bitcoin_qt_ldadd)
434+
dash_gui_SOURCES = $(bitcoin_qt_sources) init/bitcoin-gui.cpp
435+
dash_gui_LDADD = $(bitcoin_qt_ldadd) $(LIBBITCOIN_IPC) $(LIBBITCOIN_UTIL) $(LIBMULTIPROCESS_LIBS)
436436
dash_gui_LDFLAGS = $(bitcoin_qt_ldflags)
437437
dash_gui_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags)
438438

src/Makefile.qttest.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ qt_test_test_dash_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_
3333
$(QT_INCLUDES) $(QT_TEST_INCLUDES) $(BOOST_CPPFLAGS)
3434

3535
qt_test_test_dash_qt_SOURCES = \
36-
init/bitcoind.cpp \
36+
init/bitcoin-qt.cpp \
3737
qt/test/apptests.cpp \
3838
qt/test/optiontests.cpp \
3939
qt/test/rpcnestedtests.cpp \

src/bitcoin-wallet.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <chainparams.h>
1010
#include <chainparamsbase.h>
1111
#include <compat/compat.h>
12+
#include <interfaces/init.h>
1213
#include <logging.h>
1314
#include <util/strencodings.h>
1415
#include <clientversion.h>
@@ -100,6 +101,13 @@ MAIN_FUNCTION
100101
util::WinCmdLineArgs winArgs;
101102
std::tie(argc, argv) = winArgs.get();
102103
#endif
104+
105+
int exit_status;
106+
std::unique_ptr<interfaces::Init> init = interfaces::MakeWalletInit(argc, argv, exit_status);
107+
if (!init) {
108+
return exit_status;
109+
}
110+
103111
SetupEnvironment();
104112
RandomInit();
105113
try {

src/init/bitcoin-gui.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2021 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <interfaces/chain.h>
6+
#include <interfaces/coinjoin.h>
7+
#include <interfaces/echo.h>
8+
#include <interfaces/init.h>
9+
#include <interfaces/ipc.h>
10+
#include <interfaces/node.h>
11+
#include <interfaces/wallet.h>
12+
#include <node/context.h>
13+
#include <util/system.h>
14+
15+
#include <memory>
16+
17+
namespace init {
18+
namespace {
19+
const char* EXE_NAME = "dash-gui";
20+
21+
class BitcoinGuiInit : public interfaces::Init
22+
{
23+
public:
24+
BitcoinGuiInit(const char* arg0) : m_ipc(interfaces::MakeIpc(EXE_NAME, arg0, *this))
25+
{
26+
m_node.args = &gArgs;
27+
m_node.init = this;
28+
}
29+
std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); }
30+
std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); }
31+
std::unique_ptr<interfaces::CoinJoin::Loader> makeCoinJoinLoader() override
32+
{
33+
return interfaces::MakeCoinJoinLoader(m_node);
34+
}
35+
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain, interfaces::CoinJoin::Loader& coinjoin_loader) override
36+
{
37+
return MakeWalletLoader(chain, *Assert(m_node.args), m_node, coinjoin_loader);
38+
}
39+
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
40+
interfaces::Ipc* ipc() override { return m_ipc.get(); }
41+
node::NodeContext m_node;
42+
std::unique_ptr<interfaces::Ipc> m_ipc;
43+
};
44+
} // namespace
45+
} // namespace init
46+
47+
namespace interfaces {
48+
std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[])
49+
{
50+
return std::make_unique<init::BitcoinGuiInit>(argc > 0 ? argv[0] : "");
51+
}
52+
} // namespace interfaces

src/init/bitcoin-qt.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) 2021 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <interfaces/chain.h>
6+
#include <interfaces/coinjoin.h>
7+
#include <interfaces/echo.h>
8+
#include <interfaces/init.h>
9+
#include <interfaces/node.h>
10+
#include <interfaces/wallet.h>
11+
#include <node/context.h>
12+
#include <util/system.h>
13+
14+
#include <memory>
15+
16+
namespace init {
17+
namespace {
18+
class BitcoinQtInit : public interfaces::Init
19+
{
20+
public:
21+
BitcoinQtInit()
22+
{
23+
m_node.args = &gArgs;
24+
m_node.init = this;
25+
}
26+
std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); }
27+
std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); }
28+
std::unique_ptr<interfaces::CoinJoin::Loader> makeCoinJoinLoader() override
29+
{
30+
return interfaces::MakeCoinJoinLoader(m_node);
31+
}
32+
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain, interfaces::CoinJoin::Loader& coinjoin_loader) override
33+
{
34+
return MakeWalletLoader(chain, *Assert(m_node.args), m_node, coinjoin_loader);
35+
}
36+
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
37+
node::NodeContext m_node;
38+
};
39+
} // namespace
40+
} // namespace init
41+
42+
namespace interfaces {
43+
std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[])
44+
{
45+
return std::make_unique<init::BitcoinQtInit>();
46+
}
47+
} // namespace interfaces

src/init/bitcoin-wallet.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2021 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <interfaces/init.h>
6+
7+
namespace interfaces {
8+
std::unique_ptr<Init> MakeWalletInit(int argc, char* argv[], int& exit_status)
9+
{
10+
return std::make_unique<Init>();
11+
}
12+
} // namespace interfaces

0 commit comments

Comments
 (0)