mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge pull request #4409 from christiancfifi/backports
Backports 14926, 14964, 14573, 14979, 14981
This commit is contained in:
commit
738f154d26
@ -59,6 +59,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QUrlQuery>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWindow>
|
||||
|
||||
|
||||
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,10 +496,12 @@ void BitcoinGUI::createMenuBar()
|
||||
file->addAction(signMessageAction);
|
||||
file->addAction(verifyMessageAction);
|
||||
file->addSeparator();
|
||||
file->addAction(usedSendingAddressesAction);
|
||||
file->addAction(usedReceivingAddressesAction);
|
||||
file->addSeparator();
|
||||
}
|
||||
file->addAction(openConfEditorAction);
|
||||
if(walletFrame) {
|
||||
file->addAction(showBackupsAction);
|
||||
}
|
||||
file->addSeparator();
|
||||
file->addAction(quitAction);
|
||||
|
||||
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
|
||||
@ -512,18 +515,61 @@ void BitcoinGUI::createMenuBar()
|
||||
}
|
||||
settings->addAction(optionsAction);
|
||||
|
||||
QMenu *tools = appMenuBar->addMenu(tr("&Tools"));
|
||||
tools->addAction(openInfoAction);
|
||||
tools->addAction(openRPCConsoleAction);
|
||||
tools->addAction(openGraphAction);
|
||||
tools->addAction(openPeersAction);
|
||||
if(walletFrame) {
|
||||
tools->addAction(openRepairAction);
|
||||
QMenu* window_menu = appMenuBar->addMenu(tr("&Window"));
|
||||
|
||||
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();
|
||||
});
|
||||
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"));
|
||||
connect(zoom_action, &QAction::triggered, [] {
|
||||
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"));
|
||||
connect(restore_action, &QAction::triggered, [] {
|
||||
qApp->focusWindow()->showNormal();
|
||||
});
|
||||
|
||||
connect(qApp, &QApplication::focusWindowChanged, [restore_action] (QWindow* window) {
|
||||
restore_action->setEnabled(window != nullptr);
|
||||
});
|
||||
#endif
|
||||
|
||||
if (walletFrame) {
|
||||
window_menu->addSeparator();
|
||||
QAction* main_window_action = window_menu->addAction(tr("Main Window"));
|
||||
connect(main_window_action, &QAction::triggered, [this] {
|
||||
GUIUtil::bringToFront(this);
|
||||
});
|
||||
|
||||
window_menu->addSeparator();
|
||||
window_menu->addAction(usedSendingAddressesAction);
|
||||
window_menu->addAction(usedReceivingAddressesAction);
|
||||
}
|
||||
tools->addSeparator();
|
||||
tools->addAction(openConfEditorAction);
|
||||
if(walletFrame) {
|
||||
tools->addAction(showBackupsAction);
|
||||
|
||||
window_menu->addSeparator();
|
||||
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
|
||||
QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type));
|
||||
connect(tab_action, &QAction::triggered, [this, tab_type] {
|
||||
rpcConsole->setTabFocus(tab_type);
|
||||
showDebugWindow();
|
||||
});
|
||||
}
|
||||
|
||||
QMenu *help = appMenuBar->addMenu(tr("&Help"));
|
||||
|
@ -1455,7 +1455,17 @@ void RPCConsole::showOrHideBanTableIfRequired()
|
||||
ui->banHeading->setVisible(visible);
|
||||
}
|
||||
|
||||
RPCConsole::TabTypes RPCConsole::tabFocus() const
|
||||
{
|
||||
return (TabTypes) ui->stackedWidgetRPC->currentIndex();
|
||||
}
|
||||
|
||||
void RPCConsole::setTabFocus(enum TabTypes tabType)
|
||||
{
|
||||
showPage(tabType);
|
||||
}
|
||||
|
||||
QString RPCConsole::tabTitle(TabTypes tab_type) const
|
||||
{
|
||||
return pageButtons->button(tab_type)->text();
|
||||
}
|
||||
|
@ -67,6 +67,11 @@ public:
|
||||
TAB_REPAIR = 4
|
||||
};
|
||||
|
||||
std::vector<TabTypes> 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;
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
@ -53,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'))
|
||||
@ -60,13 +62,14 @@ 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}],
|
||||
))['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 +89,25 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
rawtxs=[raw_tx_0],
|
||||
)
|
||||
|
||||
self.log.info('A final transaction not in the mempool')
|
||||
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}],
|
||||
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],
|
||||
|
Loading…
Reference in New Issue
Block a user