Skip to content

Commit 28e20b3

Browse files
b73f48f Merge bitcoin#22057: test: use MiniWallet (P2PK mode) for feature_dersig.py (MarcoFalke) d5a8d5e Merge bitcoin#22048: test: MiniWallet: introduce enum type for output mode (MarcoFalke) f4cd20b Merge bitcoin#21945: test: add P2PK support to MiniWallet (MarcoFalke) 7be6db6 docs: add an explanation for vsize in MiniWallet (Konstantin Akimov) 5d10b41 Merge bitcoin#21840: test: Misc refactor to get rid of &foo[0] raw pointers (MarcoFalke) 7522ee9 Merge bitcoin#21900: test: use MiniWallet for feature_csv_activation.py (MarcoFalke) c6f603c Merge bitcoin#21897: rpc: adjust incorrect RPCHelpMan types (MarcoFalke) 1dffe3a Merge bitcoin#21867: test: use MiniWallet for p2p_blocksonly.py (MarcoFalke) 81d21ee Merge bitcoin#21557: test: small cleanup in RPCNestedTests tests (MarcoFalke) cc169c2 partial Merge bitcoin#20842: docs: consolidate typo & url fixing (MarcoFalke) 2be1604 Merge bitcoin#20459: rpc: Fail to return undocumented return values (MarcoFalke) Pull request description: ## What was done? Backports from v22 bitcoin. Mostly related to MiniWallet and RPC improvements, see commits ## 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 ACKs for top commit: UdjinM6: utACK b73f48f PastaPastaPasta: utACK b73f48f Tree-SHA512: 588f3a30697c0d77dadcc463aba71a00bf26eeef41b0cb8b9197799a217ebeb1d1ce7b5021ccc4576f0e9ca0e75ad840820cdc682fe8f120596788a528727a0b
2 parents 46b5113 + b73f48f commit 28e20b3

23 files changed

+297
-186
lines changed

depends/patches/fontconfig/gperf_header_regen.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ commit 7b6eb33ecd88768b28c67ce5d2d68a7eed5936b6
22
Author: fanquake <fanquake@gmail.com>
33
Date: Tue Aug 25 14:34:53 2020 +0800
44

5-
Remove rule that causes inadvertant header regeneration
5+
Remove rule that causes inadvertent header regeneration
66

77
Otherwise the makefile will needlessly attempt to re-generate the
88
headers with gperf. This can be dropped once the upstream build is fixed.

src/bench/block_assemble.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <consensus/validation.h>
88
#include <script/standard.h>
99
#include <test/util/mining.h>
10+
#include <test/util/script.h>
1011
#include <test/util/setup_common.h>
1112
#include <test/util/wallet.h>
1213
#include <txmempool.h>
@@ -31,7 +32,7 @@ static void AssembleBlock(benchmark::Bench& bench)
3132
std::array<CTransactionRef, NUM_BLOCKS - COINBASE_MATURITY + 1> txs;
3233
for (size_t b{0}; b < NUM_BLOCKS; ++b) {
3334
CMutableTransaction tx;
34-
tx.vin.push_back(MineBlock(test_setup->m_node, SCRIPT_PUB));
35+
tx.vin.push_back(MineBlock(test_setup->m_node, P2SH_OP_TRUE));
3536
tx.vin.back().scriptSig = scriptSig;
3637
tx.vout.emplace_back(1337, SCRIPT_PUB);
3738
if (NUM_BLOCKS - b >= COINBASE_MATURITY)
@@ -47,7 +48,7 @@ static void AssembleBlock(benchmark::Bench& bench)
4748
}
4849

4950
bench.minEpochIterations(700).run([&] {
50-
PrepareBlock(test_setup->m_node, SCRIPT_PUB);
51+
PrepareBlock(test_setup->m_node, P2SH_OP_TRUE);
5152
});
5253
}
5354

src/core_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
3131
/**
3232
* Parse a hex string into 256 bits
3333
* @param[in] strHex a hex-formatted, 64-character string
34-
* @param[out] result the result of the parasing
34+
* @param[out] result the result of the parsing
3535
* @returns true if successful, false if not
3636
*
3737
* @see ParseHashV for an RPC-oriented version of this

src/merkleblock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::ve
7373
//if we do not have this assert, we can hit a memory access violation when indexing into vTxid
7474
assert(vTxid.size() != 0);
7575
if (height == 0) {
76-
// hash at height 0 is the txids themself
76+
// hash at height 0 is the txids themselves
7777
return vTxid[pos];
7878
} else {
7979
// calculate left hash

src/qt/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static void RegisterMetaTypes()
8585
#ifdef ENABLE_WALLET
8686
qRegisterMetaType<WalletModel*>();
8787
#endif
88-
// Register typedefs (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)
88+
// Register typedefs (see https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType)
8989
// IMPORTANT: if CAmount is no longer a typedef use the normal variant above (see https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1)
9090
qRegisterMetaType<CAmount>("CAmount");
9191
qRegisterMetaType<size_t>("size_t");

src/qt/test/rpcnestedtests.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#include <univalue.h>
1212
#include <util/system.h>
1313

14-
#include <llmq/context.h>
14+
#include <QTest>
1515

16-
#include <QDir>
17-
#include <QtGlobal>
16+
#include <string>
17+
#include <stdexcept>
1818

1919
static RPCHelpMan rpcNestedTest_rpc()
2020
{
@@ -26,23 +26,25 @@ static RPCHelpMan rpcNestedTest_rpc()
2626
{"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
2727
{"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
2828
},
29-
{},
29+
RPCResult{RPCResult::Type::ANY, "", ""},
3030
RPCExamples{""},
31-
[](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
31+
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
3232
return request.params.write(0, 0);
3333
},
3434
};
3535
}
3636

3737
static const CRPCCommand vRPCCommands[] = {
38-
{"test", &rpcNestedTest_rpc},
38+
{"rpcNestedTest", &rpcNestedTest_rpc},
3939
};
4040

4141
void RPCNestedTests::rpcNestedTests()
4242
{
4343
// do some test setup
4444
// could be moved to a more generic place when we add more tests on QT level
45-
tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]);
45+
for (const auto& c : vRPCCommands) {
46+
tableRPC.appendCommand(c.name, &c);
47+
}
4648

4749
TestingSetup test;
4850
m_node.setContext(&test.m_node);
@@ -70,13 +72,13 @@ void RPCNestedTests::rpcNestedTests()
7072
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo "); //whitespace at the end will be tolerated
7173
QVERIFY(result.substr(0,1) == "{");
7274

73-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]")); //Quote path identifier are allowed, but look after a child containing the quotes in the key
75+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]"); //Quote path identifier are allowed, but look after a child containing the quotes in the key
7476
QVERIFY(result == "null");
7577

76-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0")); //parameter not in brackets are allowed
77-
(RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)")); //parameter in brackets are allowed
78+
RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0"); //parameter not in brackets are allowed
79+
RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)"); //parameter in brackets are allowed
7880
QVERIFY(result == result2);
79-
(RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )")); //whitespace between parameters is allowed
81+
RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )"); //whitespace between parameters is allowed
8082
QVERIFY(result == result2);
8183

8284
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock(getbestblockhash())[tx][0]", &filtered);
@@ -125,14 +127,13 @@ void RPCNestedTests::rpcNestedTests()
125127
RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )");
126128
QVERIFY(result == "[\"abc\",\"cba\"]");
127129

128-
// do the QVERIFY_EXCEPTION_THROWN checks only with Qt5.3 and higher (QVERIFY_EXCEPTION_THROWN was introduced in Qt5.3)
129130
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax
130131
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax
131-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(")); //tolerate non closing brackets if we have no arguments
132-
(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()")); //tolerate non command brackts
132+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments
133+
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()"); //tolerate non command brackets
133134
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(True)"), UniValue); //invalid argument
134135
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "a(getblockchaininfo(True))"), UniValue); //method not found
135-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc,,abc"), std::runtime_error); //don't tollerate empty arguments when using ,
136-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tollerate empty arguments when using ,
137-
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tollerate empty arguments when using ,
136+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc,,abc"), std::runtime_error); //don't tolerate empty arguments when using ,
137+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tolerate empty arguments when using ,
138+
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tolerate empty arguments when using ,
138139
}

src/qt/walletcontroller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
153153

154154
connect(wallet_model, &WalletModel::unload, this, [this, wallet_model] {
155155
// Defer removeAndDeleteWallet when no modal widget is active.
156-
// TODO: remove this workaround by removing usage of QDiallog::exec.
156+
// TODO: remove this workaround by removing usage of QDialog::exec.
157157
if (QApplication::activeModalWidget()) {
158158
connect(qApp, &QApplication::focusWindowChanged, wallet_model, [this, wallet_model]() {
159159
if (!QApplication::activeModalWidget()) {

src/rpc/misc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static RPCHelpMan echo(const std::string& name)
13921392
{"arg8", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
13931393
{"arg9", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
13941394
},
1395-
RPCResult{RPCResult::Type::NONE, "", "Returns whatever was passed in"},
1395+
RPCResult{RPCResult::Type::ANY, "", "Returns whatever was passed in"},
13961396
RPCExamples{""},
13971397
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
13981398
{

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ static RPCHelpMan createrawtransaction()
753753
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
754754
" accepted as second parameter.",
755755
{
756-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
756+
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
757757
{
758758
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the Dash address, the value (float or string) is the amount in " + CURRENCY_UNIT},
759759
},

src/rpc/server.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ static RPCHelpMan help()
171171
{"command", RPCArg::Type::STR, /* default */ "all commands", "The command to get help on"},
172172
{"subcommand", RPCArg::Type::STR, /* default */ "all subcommands", "The subcommand to get help on."},
173173
},
174-
RPCResult{
175-
RPCResult::Type::STR, "", "The help text"
174+
{
175+
RPCResult{RPCResult::Type::STR, "", "The help text"},
176+
RPCResult{RPCResult::Type::ANY, "", ""},
176177
},
177178
RPCExamples{""},
178179
[&](const RPCHelpMan& self, const JSONRPCRequest& jsonRequest) -> UniValue

0 commit comments

Comments
 (0)