Merge pull request #4565 from kittywhiskers/auxports19

merge bitcoin#15474...#16774: miscellaneous backports
This commit is contained in:
PastaPastaPasta 2021-11-12 15:45:13 -05:00 committed by GitHub
commit ee34678d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 35 additions and 32 deletions

4
.gitignore vendored
View File

@ -151,3 +151,7 @@ cmake-build-debug
# clang-check # clang-check
*.plist *.plist
osx_volname
dist/
*.background.tiff

View File

@ -304,3 +304,4 @@ clean-docs:
clean-local: clean-docs clean-local: clean-docs
rm -rf coverage_percent.txt test_dash.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP) rm -rf coverage_percent.txt test_dash.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP)
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__ rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__
rm -rf osx_volname dist/ dpi36.background.tiff dpi72.background.tiff

View File

@ -606,8 +606,15 @@ void openConfigfile()
fs::path pathConfig = GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); fs::path pathConfig = GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
/* Open dash.conf with the associated application */ /* Open dash.conf with the associated application */
if (fs::exists(pathConfig)) if (fs::exists(pathConfig)) {
QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); // Workaround for macOS-specific behavior; see #15409.
if (!QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig)))) {
#ifdef Q_OS_MAC
QProcess::startDetached("/usr/bin/open", QStringList{"-t", boostPathToQString(pathConfig)});
#endif
return;
}
}
} }
void showBackups() void showBackups()

View File

@ -221,7 +221,7 @@ void ReceiveCoinsDialog::copyColumnToClipboard(int column)
if (!firstIndex.isValid()) { if (!firstIndex.isValid()) {
return; return;
} }
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString()); GUIUtil::setClipboard(model->getRecentRequestsTableModel()->index(firstIndex.row(), column).data(Qt::EditRole).toString());
} }
// context menu // context menu

View File

@ -68,7 +68,7 @@ public:
QVariant data(const QModelIndex &index, int role) const override; QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override; bool setData(const QModelIndex &index, const QVariant &value, int role) override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QModelIndex index(int row, int column, const QModelIndex &parent) const override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
Qt::ItemFlags flags(const QModelIndex &index) const override; Qt::ItemFlags flags(const QModelIndex &index) const override;
/*@}*/ /*@}*/

View File

@ -40,7 +40,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QScrollBar> #include <QScrollBar>
#include <QSettings> #include <QSettings>
#include <QSignalMapper>
#include <QTime> #include <QTime>
#include <QTimer> #include <QTimer>
#include <QStringList> #include <QStringList>
@ -651,19 +650,10 @@ void RPCConsole::setClientModel(ClientModel *model)
peersTableContextMenu->addAction(banAction7d); peersTableContextMenu->addAction(banAction7d);
peersTableContextMenu->addAction(banAction365d); peersTableContextMenu->addAction(banAction365d);
// Add a signal mapping to allow dynamic context menu arguments. connect(banAction1h, &QAction::triggered, [this] { banSelectedNode(60 * 60); });
// We need to use int (instead of int64_t), because signal mapper only supports connect(banAction24h, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24); });
// int or objects, which is okay because max bantime (1 year) is < int_max. connect(banAction7d, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24 * 7); });
QSignalMapper* signalMapper = new QSignalMapper(this); connect(banAction365d, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24 * 365); });
signalMapper->setMapping(banAction1h, 60*60);
signalMapper->setMapping(banAction24h, 60*60*24);
signalMapper->setMapping(banAction7d, 60*60*24*7);
signalMapper->setMapping(banAction365d, 60*60*24*365);
connect(banAction1h, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(banAction24h, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(banAction7d, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(banAction365d, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(signalMapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, &RPCConsole::banSelectedNode);
// peer table context menu signals // peer table context menu signals
connect(ui->peerWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showPeersTableContextMenu); connect(ui->peerWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showPeersTableContextMenu);

View File

@ -125,6 +125,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
const TrafficGraphData::SampleQueue& queue = trafficGraphData.getCurrentRangeQueueWithAverageBandwidth(); const TrafficGraphData::SampleQueue& queue = trafficGraphData.getCurrentRangeQueueWithAverageBandwidth();
if(!queue.empty()) { if(!queue.empty()) {
painter.setRenderHint(QPainter::Antialiasing);
QPainterPath pIn; QPainterPath pIn;
QColor lucentGreen = green; QColor lucentGreen = green;
lucentGreen.setAlpha(128); lucentGreen.setAlpha(128);
@ -142,6 +143,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
painter.fillPath(pOut, lucentRed); painter.fillPath(pOut, lucentRed);
painter.setPen(red); painter.setPen(red);
painter.drawPath(pOut); painter.drawPath(pOut);
painter.setRenderHint(QPainter::Antialiasing, false);
} }
// draw text // draw text

View File

@ -33,7 +33,6 @@
#include <QPoint> #include <QPoint>
#include <QScrollBar> #include <QScrollBar>
#include <QSettings> #include <QSettings>
#include <QSignalMapper>
#include <QTableView> #include <QTableView>
#include <QTextCharFormat> #include <QTextCharFormat>
#include <QTimer> #include <QTimer>
@ -173,11 +172,6 @@ transactionView(nullptr), abandonAction(nullptr), columnResizingFixer(nullptr)
contextMenu->addAction(abandonAction); contextMenu->addAction(abandonAction);
contextMenu->addAction(editLabelAction); contextMenu->addAction(editLabelAction);
mapperThirdPartyTxUrls = new QSignalMapper(this);
// Connect actions
connect(mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped), this, &TransactionView::openThirdPartyTxUrl);
connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate); connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate);
connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType); connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType);
connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly); connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
@ -244,15 +238,15 @@ void TransactionView::setModel(WalletModel *_model)
QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts);
for (int i = 0; i < listUrls.size(); ++i) for (int i = 0; i < listUrls.size(); ++i)
{ {
QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); QString url = listUrls[i].trimmed();
QString host = QUrl(url, QUrl::StrictMode).host();
if (!host.isEmpty()) if (!host.isEmpty())
{ {
QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label
if (i == 0) if (i == 0)
contextMenu->addSeparator(); contextMenu->addSeparator();
contextMenu->addAction(thirdPartyTxUrlAction); contextMenu->addAction(thirdPartyTxUrlAction);
connect(thirdPartyTxUrlAction, &QAction::triggered, mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); });
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed());
} }
} }

View File

@ -23,7 +23,6 @@ class QItemSelectionModel;
class QLineEdit; class QLineEdit;
class QMenu; class QMenu;
class QModelIndex; class QModelIndex;
class QSignalMapper;
class QTableView; class QTableView;
QT_END_NAMESPACE QT_END_NAMESPACE
@ -71,7 +70,6 @@ private:
QLineEdit *amountWidget; QLineEdit *amountWidget;
QMenu *contextMenu; QMenu *contextMenu;
QSignalMapper *mapperThirdPartyTxUrls;
QFrame *dateRangeWidget; QFrame *dateRangeWidget;
QDateTimeEdit *dateFrom; QDateTimeEdit *dateFrom;

View File

@ -1680,6 +1680,8 @@ static UniValue getchaintips(const JSONRPCRequest& request)
UniValue MempoolInfoToJSON(const CTxMemPool& pool) UniValue MempoolInfoToJSON(const CTxMemPool& pool)
{ {
// Make sure this call is atomic in the pool.
LOCK(pool.cs);
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
ret.pushKV("size", (int64_t)pool.size()); ret.pushKV("size", (int64_t)pool.size());
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize()); ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());

View File

@ -381,8 +381,8 @@ UniValue deriveaddresses(const JSONRPCRequest& request)
} }
} }
FlatSigningProvider provider; FlatSigningProvider key_provider;
auto desc = Parse(desc_str, provider, /* require_checksum = */ true); auto desc = Parse(desc_str, key_provider, /* require_checksum = */ true);
if (!desc) { if (!desc) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid descriptor")); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid descriptor"));
} }
@ -398,8 +398,9 @@ UniValue deriveaddresses(const JSONRPCRequest& request)
UniValue addresses(UniValue::VARR); UniValue addresses(UniValue::VARR);
for (int i = range_begin; i <= range_end; ++i) { for (int i = range_begin; i <= range_end; ++i) {
FlatSigningProvider provider;
std::vector<CScript> scripts; std::vector<CScript> scripts;
if (!desc->Expand(i, provider, scripts, provider)) { if (!desc->Expand(i, key_provider, scripts, provider)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Cannot derive script without private keys")); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Cannot derive script without private keys"));
} }

View File

@ -86,10 +86,14 @@ class TestNode():
# Note that common args are set in the config file (see initialize_datadir) # Note that common args are set in the config file (see initialize_datadir)
self.extra_args = extra_args self.extra_args = extra_args
self.extra_args_from_options = extra_args_from_options self.extra_args_from_options = extra_args_from_options
# Configuration for logging is set as command-line args rather than in the bitcoin.conf file.
# This means that starting a bitcoind using the temp dir to debug a failed test won't
# spam debug.log.
self.args = [ self.args = [
self.binary, self.binary,
"-datadir=" + self.datadir, "-datadir=" + self.datadir,
"-logtimemicros", "-logtimemicros",
"-logthreadnames",
"-debug", "-debug",
"-debugexclude=libevent", "-debugexclude=libevent",
"-debugexclude=leveldb", "-debugexclude=leveldb",