From 9273ffd338918097bae544dca7a3eb1f9968ec74 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 13 Dec 2018 14:21:09 +0100 Subject: [PATCH 1/7] Merge #14926: test: consensus: Check that final transactions are valid aaaa8eb1edba2a28916d5da6001d421c1b1b253b test: consensus: Check that final transactions are valid (MarcoFalke) fae3617d79deee73dd375dc3ea5f4204a74420c5 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290 --- test/functional/mempool_accept.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index 0da10ed65e..1d77296f8c 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -6,6 +6,7 @@ from io import BytesIO import math + from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import ( BIP125_SEQUENCE_NUMBER, @@ -67,6 +68,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): ))['hex'] txid_in_block = node.sendrawtransaction(hexstring=raw_tx_in_block, allowhighfees=True) node.generate(1) + self.mempool_size = 0 self.check_mempool_result( result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': '18: txn-already-known'}], rawtxs=[raw_tx_in_block], @@ -86,9 +88,25 @@ class MempoolAcceptanceTest(BitcoinTestFramework): rawtxs=[raw_tx_0], ) + self.log.info('A final transaction not in the mempool') + coin = node.listunspent()[0] # Pick a random coin(base) to spend + raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction( + inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL + outputs=[{node.getnewaddress(): 0.025}], + locktime=node.getblockcount() + 2000, # Can be anything + ))['hex'] + tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_final))) + self.check_mempool_result( + result_expected=[{'txid': tx.rehash(), 'allowed': True}], + rawtxs=[tx.serialize().hex()], + allowhighfees=True, + ) + node.sendrawtransaction(hexstring=raw_tx_final, allowhighfees=True) + self.mempool_size += 1 + self.log.info('A transaction in the mempool') node.sendrawtransaction(hexstring=raw_tx_0) - self.mempool_size = 1 + self.mempool_size += 1 self.check_mempool_result( result_expected=[{'txid': txid_0, 'allowed': False, 'reject-reason': '18: txn-already-in-mempool'}], rawtxs=[raw_tx_0], From 1fb61d1b660cd77d16e244f6436b443eb7c1fca0 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 17 Dec 2018 10:11:30 -0500 Subject: [PATCH 2/7] Merge #14964: test: Fix race in mempool_accept faee59103d test: Fix race in mempool_accept (MarcoFalke) Pull request description: If we happen to pick the same random coin to spend, there would be mempool conflicts in some runs of the test. Fix that by popping from a static list of coins to spend from. Tree-SHA512: f6fd37e43d919371aa8bc3a2c93b569f9169961fe702f3641bb63180c3a88f12ca1857e9ed4d3723d5f04ca8ab5ef009a90e679580f36246a10b987620a55bee --- test/functional/mempool_accept.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index 1d77296f8c..14b0caaf95 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -54,6 +54,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): self.mempool_size = 0 wait_until(lambda: node.getblockcount() == 200) assert_equal(node.getmempoolinfo()['size'], self.mempool_size) + coins = node.listunspent() self.log.info('Should not accept garbage to testmempoolaccept') assert_raises_rpc_error(-3, 'Expected type array, got string', lambda: node.testmempoolaccept(rawtxs='ff00baar')) @@ -61,7 +62,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): assert_raises_rpc_error(-22, 'TX decode failed', lambda: node.testmempoolaccept(rawtxs=['ff00baar'])) self.log.info('A transaction already in the blockchain') - coin = node.listunspent()[0] # Pick a random coin(base) to spend + coin = coins.pop() # Pick a random coin(base) to spend raw_tx_in_block = node.signrawtransactionwithwallet(node.createrawtransaction( inputs=[{'txid': coin['txid'], 'vout': coin['vout']}], outputs=[{node.getnewaddress(): 0.3}, {node.getnewaddress(): 49}], @@ -89,7 +90,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): ) self.log.info('A final transaction not in the mempool') - coin = node.listunspent()[0] # Pick a random coin(base) to spend + coin = coins.pop() # Pick a random coin(base) to spend raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction( inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL outputs=[{node.getnewaddress(): 0.025}], From 2662672a9bd8b85d0e90f2dfe542a0f6f24d7a95 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 15 Dec 2018 20:12:57 -1000 Subject: [PATCH 3/7] Merge #14573: qt: Add Window menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 95a5a9fcc qt: Remove ellipsis from sending/receiving addresses (João Barbosa) a96c0df35 qt: Add Window menu (João Barbosa) 9ea38d022 qt: Allow to inspect RPCConsole tabs (João Barbosa) Pull request description: Overall this PR does the following: - add top level menu Window - add Minimize and Zoom actions to Window menu - move Sending/Receiving address to Window - remove Help->Debug window - add one menu entry for each debug window tab This removes the access to address book from the File menu. With wallet support: screenshot 2018-12-11 at 00 33 05 Without wallet support: screenshot 2018-12-11 at 12 55 21 Tree-SHA512: 4fb03702efe18df7bae33950e462940162abe634c55d0214b8920812127b763234cc9b73f27b3702502a37b6d49bdd6c50b7c8d9a3daea75cecb0136556dd1ea --- src/qt/bitcoingui.cpp | 60 +++++++++++++++++++++++++++++++++++++++---- src/qt/rpcconsole.cpp | 10 ++++++++ src/qt/rpcconsole.h | 5 ++++ 3 files changed, 70 insertions(+), 5 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 84c0504f94..c6cfe4bcd3 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -59,6 +59,7 @@ #include #include #include +#include const std::string BitcoinGUI::DEFAULT_UIPLATFORM = @@ -410,9 +411,9 @@ void BitcoinGUI::createActions() openPeersAction->setEnabled(false); openRepairAction->setEnabled(false); - usedSendingAddressesAction = new QAction(tr("&Sending addresses..."), this); + usedSendingAddressesAction = new QAction(tr("&Sending addresses"), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); - usedReceivingAddressesAction = new QAction(tr("&Receiving addresses..."), this); + usedReceivingAddressesAction = new QAction(tr("&Receiving addresses"), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); openAction = new QAction(tr("Open &URI..."), this); @@ -495,9 +496,6 @@ void BitcoinGUI::createMenuBar() file->addAction(signMessageAction); file->addAction(verifyMessageAction); file->addSeparator(); - file->addAction(usedSendingAddressesAction); - file->addAction(usedReceivingAddressesAction); - file->addSeparator(); } file->addAction(quitAction); @@ -512,6 +510,58 @@ void BitcoinGUI::createMenuBar() } settings->addAction(optionsAction); + QMenu* window_menu = appMenuBar->addMenu(tr("&Window")); + + QAction* minimize_action = window_menu->addAction(tr("Minimize"), [] { + qApp->focusWindow()->showMinimized(); + }, QKeySequence(Qt::CTRL + Qt::Key_M)); + + connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) { + minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized); + }); + +#ifdef Q_OS_MAC + QAction* zoom_action = window_menu->addAction(tr("Zoom"), [] { + QWindow* window = qApp->focusWindow(); + if (window->windowState() != Qt::WindowMaximized) { + window->showMaximized(); + } else { + window->showNormal(); + } + }); + + connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) { + zoom_action->setEnabled(window != nullptr); + }); +#else + QAction* restore_action = window_menu->addAction(tr("Restore"), [] { + qApp->focusWindow()->showNormal(); + }); + + connect(qApp, &QApplication::focusWindowChanged, [restore_action] (QWindow* window) { + restore_action->setEnabled(window != nullptr); + }); +#endif + + if (walletFrame) { + window_menu->addSeparator(); + window_menu->addAction(tr("Main Window"), [this] { + GUIUtil::bringToFront(this); + }); + + window_menu->addSeparator(); + window_menu->addAction(usedSendingAddressesAction); + window_menu->addAction(usedReceivingAddressesAction); + } + + window_menu->addSeparator(); + for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) { + window_menu->addAction(rpcConsole->tabTitle(tab_type), [this, tab_type] { + rpcConsole->setTabFocus(tab_type); + showDebugWindow(); + }); + } + QMenu *tools = appMenuBar->addMenu(tr("&Tools")); tools->addAction(openInfoAction); tools->addAction(openRPCConsoleAction); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 708c4f0e56..94756e2147 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1455,7 +1455,17 @@ void RPCConsole::showOrHideBanTableIfRequired() ui->banHeading->setVisible(visible); } +RPCConsole::TabTypes RPCConsole::tabFocus() const +{ + return (TabTypes) ui->tabWidget->currentIndex(); +} + void RPCConsole::setTabFocus(enum TabTypes tabType) { showPage(tabType); } + +QString RPCConsole::tabTitle(TabTypes tab_type) const +{ + return ui->tabWidget->tabText(tab_type); +} diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 371b142356..c6b369582d 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -67,6 +67,11 @@ public: TAB_REPAIR = 4 }; + std::vector tabs() const { return {TAB_INFO, TAB_CONSOLE, TAB_GRAPH, TAB_PEERS, TAB_REPAIR}; } + + TabTypes tabFocus() const; + QString tabTitle(TabTypes tab_type) const; + protected: virtual bool eventFilter(QObject* obj, QEvent *event) override; void keyPressEvent(QKeyEvent *) override; From a05ada38a9f789eecebfb1d12068427e6e94661a Mon Sep 17 00:00:00 2001 From: christiancfifi Date: Wed, 25 Aug 2021 02:43:44 -0500 Subject: [PATCH 4/7] Fix #14573: Alter to work with Dash UI The Dash UI changes were introduced in 83420a18cf ("qt: Replace usage of QTabBar with custom replacement (#3560)", 2020-07-14) --- src/qt/rpcconsole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 94756e2147..06cfd4dd07 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1457,7 +1457,7 @@ void RPCConsole::showOrHideBanTableIfRequired() RPCConsole::TabTypes RPCConsole::tabFocus() const { - return (TabTypes) ui->tabWidget->currentIndex(); + return (TabTypes) ui->stackedWidgetRPC->currentIndex(); } void RPCConsole::setTabFocus(enum TabTypes tabType) @@ -1467,5 +1467,5 @@ void RPCConsole::setTabFocus(enum TabTypes tabType) QString RPCConsole::tabTitle(TabTypes tab_type) const { - return ui->tabWidget->tabText(tab_type); + return pageButtons->button(tab_type)->text(); } From 3056af473cd982e66a8555837d1c10fc40f3f9a2 Mon Sep 17 00:00:00 2001 From: Christian Fifi Culp Date: Sat, 11 Sep 2021 15:32:15 -0500 Subject: [PATCH 5/7] Fix #14573: Drop Tools menu, move actions to File menu --- src/qt/bitcoingui.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index c6cfe4bcd3..0faa230f78 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -497,6 +497,11 @@ void BitcoinGUI::createMenuBar() file->addAction(verifyMessageAction); file->addSeparator(); } + file->addAction(openConfEditorAction); + if(walletFrame) { + file->addAction(showBackupsAction); + } + file->addSeparator(); file->addAction(quitAction); QMenu *settings = appMenuBar->addMenu(tr("&Settings")); @@ -562,20 +567,6 @@ void BitcoinGUI::createMenuBar() }); } - QMenu *tools = appMenuBar->addMenu(tr("&Tools")); - tools->addAction(openInfoAction); - tools->addAction(openRPCConsoleAction); - tools->addAction(openGraphAction); - tools->addAction(openPeersAction); - if(walletFrame) { - tools->addAction(openRepairAction); - } - tools->addSeparator(); - tools->addAction(openConfEditorAction); - if(walletFrame) { - tools->addAction(showBackupsAction); - } - QMenu *help = appMenuBar->addMenu(tr("&Help")); help->addAction(showHelpMessageAction); help->addAction(showCoinJoinHelpAction); From 60cfe1007497366c461be0556d536db07d98aba1 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 17 Dec 2018 12:51:59 +0100 Subject: [PATCH 6/7] Merge #14979: [Qt] Restore < Qt5.6 compatibility for addAction 3e21b690d1aedb73a7dc2bc5d2ff1b011b52d927 [Qt] Restore < Qt5.6 compatibility for addAction (Jonas Schnelli) Pull request description: #14573 broke < Qt5.6 compatibility due to calling the lambda version of `addAction` that was added in Qt5.6. This PR re-enables < Qt5.6 compatibility. Tree-SHA512: b3cf055d88a76713d100be05b2298d4091967e1a43de176af2647f59e76b98b216493dd12a6d68a942ae7946f2026e33dd8e8d20fc44a9a9614a3690ad9a2417 --- src/qt/bitcoingui.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 0faa230f78..0595fac6f4 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -517,16 +517,18 @@ void BitcoinGUI::createMenuBar() QMenu* window_menu = appMenuBar->addMenu(tr("&Window")); - QAction* minimize_action = window_menu->addAction(tr("Minimize"), [] { + QAction* minimize_action = window_menu->addAction(tr("Minimize")); + minimize_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + connect(minimize_action, &QAction::triggered, [] { qApp->focusWindow()->showMinimized(); - }, QKeySequence(Qt::CTRL + Qt::Key_M)); - + }); connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) { minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized); }); #ifdef Q_OS_MAC - QAction* zoom_action = window_menu->addAction(tr("Zoom"), [] { + QAction* zoom_action = window_menu->addAction(tr("Zoom")); + connect(zoom_action, &QAction::triggered, [] { QWindow* window = qApp->focusWindow(); if (window->windowState() != Qt::WindowMaximized) { window->showMaximized(); @@ -539,7 +541,8 @@ void BitcoinGUI::createMenuBar() zoom_action->setEnabled(window != nullptr); }); #else - QAction* restore_action = window_menu->addAction(tr("Restore"), [] { + QAction* restore_action = window_menu->addAction(tr("Restore")); + connect(restore_action, &QAction::triggered, [] { qApp->focusWindow()->showNormal(); }); @@ -550,7 +553,8 @@ void BitcoinGUI::createMenuBar() if (walletFrame) { window_menu->addSeparator(); - window_menu->addAction(tr("Main Window"), [this] { + QAction* main_window_action = window_menu->addAction(tr("Main Window")); + connect(main_window_action, &QAction::triggered, [this] { GUIUtil::bringToFront(this); }); @@ -561,7 +565,8 @@ void BitcoinGUI::createMenuBar() window_menu->addSeparator(); for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) { - window_menu->addAction(rpcConsole->tabTitle(tab_type), [this, tab_type] { + QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type)); + connect(tab_action, &QAction::triggered, [this, tab_type] { rpcConsole->setTabFocus(tab_type); showDebugWindow(); }); From 89cc09515daa949c54026881e610684ba16c185b Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 28 Dec 2018 12:19:25 +0100 Subject: [PATCH 7/7] Merge #14981: rpc: Clarifying RPC getrawtransaction's time help text 84104c781a clarifying getrawtransaction[time] get help text (Ben Carman) Pull request description: #12339 The `time` and `blocktime` entries have the same value so they should have the same help text as well Tree-SHA512: 1e9a94678eec8501c761f16bf3d8e269d68620596d1fdd31a32989a1b53be5a8097ece8bfabe99979e658dec82237e37d8194ae2acd7c1deef7501ee701667fb --- src/rpc/rawtransaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 91323b7b27..8b5b09ce2b 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -170,8 +170,8 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) " \"blockhash\" : \"hash\", (string) the block hash\n" " \"height\" : n, (numeric) The block height\n" " \"confirmations\" : n, (numeric) The confirmations\n" - " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n" " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" + " \"time\" : ttt, (numeric) Same as \"blocktime\"\n" " \"instantlock\" : true|false, (bool) Current transaction lock state\n" " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state\n" " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"