Merge pull request #4615 from Munkybooty/backports-0.19-pr10

Backports 0.19 pr10
This commit is contained in:
PastaPastaPasta 2021-12-29 14:23:23 -05:00 committed by GitHub
commit 03abbd3b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 35 deletions

View File

@ -77,7 +77,7 @@ To assist in updating translations, we have created a script to help.
1. `python contrib/devtools/update-translations.py`
2. Update `src/qt/dash_locale.qrc` manually or via
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(dash_\(.*\)\).ts/<file alias="\2">locale\/\1.qm<\/file>/'`
3. Update `src/Makefile.qt.include` manually or via
3. Update `src/Makefile.qt_locale.include` manually or via
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(dash_\(.*\)\).ts/ qt\/locale\/\1.ts \\/'`
4. `git add` new translations from `src/qt/locale/`

View File

@ -7,28 +7,7 @@ bin_PROGRAMS += qt/dash-qt
EXTRA_LIBRARIES += qt/libdashqt.a
# dash qt core #
QT_TS = \
qt/locale/dash_ar.ts \
qt/locale/dash_bg.ts \
qt/locale/dash_de.ts \
qt/locale/dash_en.ts \
qt/locale/dash_es.ts \
qt/locale/dash_fi.ts \
qt/locale/dash_fr.ts \
qt/locale/dash_it.ts \
qt/locale/dash_ja.ts \
qt/locale/dash_ko.ts \
qt/locale/dash_nl.ts \
qt/locale/dash_pl.ts \
qt/locale/dash_pt.ts \
qt/locale/dash_ro.ts \
qt/locale/dash_ru.ts \
qt/locale/dash_sk.ts \
qt/locale/dash_th.ts \
qt/locale/dash_tr.ts \
qt/locale/dash_vi.ts \
qt/locale/dash_zh_CN.ts \
qt/locale/dash_zh_TW.ts
include Makefile.qt_locale.include
QT_FORMS_UI = \
qt/forms/addressbookpage.ui \

View File

@ -0,0 +1,22 @@
QT_TS = \
qt/locale/dash_ar.ts \
qt/locale/dash_bg.ts \
qt/locale/dash_de.ts \
qt/locale/dash_en.ts \
qt/locale/dash_es.ts \
qt/locale/dash_fi.ts \
qt/locale/dash_fr.ts \
qt/locale/dash_it.ts \
qt/locale/dash_ja.ts \
qt/locale/dash_ko.ts \
qt/locale/dash_nl.ts \
qt/locale/dash_pl.ts \
qt/locale/dash_pt.ts \
qt/locale/dash_ro.ts \
qt/locale/dash_ru.ts \
qt/locale/dash_sk.ts \
qt/locale/dash_th.ts \
qt/locale/dash_tr.ts \
qt/locale/dash_vi.ts \
qt/locale/dash_zh_CN.ts \
qt/locale/dash_zh_TW.ts

View File

@ -61,6 +61,36 @@ QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const i
}
}
#ifndef ENABLE_BIP70
// Takes an encoded PaymentRequest as a string and tries to find the Common Name of the X.509 certificate
// used to sign the PaymentRequest.
bool GetPaymentRequestMerchant(const std::string& pr, QString& merchant)
{
// Search for the supported pki type strings
if (pr.find(std::string({0x12, 0x0b}) + "x509+sha256") != std::string::npos || pr.find(std::string({0x12, 0x09}) + "x509+sha1") != std::string::npos) {
// We want the common name of the Subject of the cert. This should be the second occurrence
// of the bytes 0x0603550403. The first occurrence of those is the common name of the issuer.
// After those bytes will be either 0x13 or 0x0C, then length, then either the ascii or utf8
// string with the common name which is the merchant name
size_t cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03});
if (cn_pos != std::string::npos) {
cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03}, cn_pos + 5);
if (cn_pos != std::string::npos) {
cn_pos += 5;
if (pr[cn_pos] == 0x13 || pr[cn_pos] == 0x0c) {
cn_pos++; // Consume the type
int str_len = pr[cn_pos];
cn_pos++; // Consume the string length
merchant = QString::fromUtf8(pr.data() + cn_pos, str_len);
return true;
}
}
}
}
return false;
}
#endif
QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit)
{
int numBlocks;
@ -266,26 +296,34 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
strHTML += "<b>" + tr("Transaction total size") + ":</b> " + QString::number(wtx.tx->GetTotalSize()) + " bytes<br>";
// Message from normal dash:URI (dash:XyZ...?message=example)
for (const std::pair<std::string, std::string>& r : orderForm)
for (const std::pair<std::string, std::string>& r : orderForm) {
if (r.first == "Message")
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>";
#ifdef ENABLE_BIP70
//
// PaymentRequest info:
//
for (const std::pair<std::string, std::string>& r : orderForm)
{
//
// PaymentRequest info:
//
if (r.first == "PaymentRequest")
{
QString merchant;
#ifdef ENABLE_BIP70
PaymentRequestPlus req;
req.parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
QString merchant;
if (req.getMerchant(PaymentServer::getCertStore(), merchant))
if (!req.getMerchant(PaymentServer::getCertStore(), merchant)) {
merchant.clear();
}
#else
if (!GetPaymentRequestMerchant(r.second, merchant)) {
merchant.clear();
} else {
merchant += tr(" (Certificate was not verified)");
}
#endif
if (!merchant.isNull()) {
strHTML += "<b>" + tr("Merchant") + ":</b> " + GUIUtil::HtmlEscape(merchant) + "<br>";
}
}
}
#endif
if (wtx.is_coinbase)
{

View File

@ -1439,7 +1439,7 @@ static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Conse
{
rv.pushKV("bit", consensusParams.vDeployments[id].bit);
}
rv.pushKV("startTime", consensusParams.vDeployments[id].nStartTime);
rv.pushKV("start_time", consensusParams.vDeployments[id].nStartTime);
rv.pushKV("timeout", consensusParams.vDeployments[id].nTimeout);
rv.pushKV("since", VersionBitsTipStateSinceHeight(consensusParams, id));
if (ThresholdState::STARTED == thresholdState)
@ -1502,7 +1502,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
" \"xxxx\" : { (string) name of the softfork\n"
" \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"\n"
" \"bit\": xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for \"started\" status)\n"
" \"startTime\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n"
" \"start_time\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n"
" \"timeout\": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n"
" \"since\": xx, (numeric) height of the first block to which the status applies\n"
" \"statistics\": { (object) numeric statistics about BIP9 signalling for a softfork (only for \"started\" status)\n"