Skip to content

Commit

Permalink
Fix rapids prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
volbil committed Apr 12, 2021
1 parent 1482e1a commit 9006422
Show file tree
Hide file tree
Showing 24 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/pivxd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool AppInit(int argc, char* argv[])
// Command-line RPC
bool fCommandLine = false;
for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "pivx:"))
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "rapids:"))
fCommandLine = true;

if (fCommandLine) {
Expand Down
4 changes: 2 additions & 2 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ bool parseBitcoinURI(const QUrl& uri, SendCoinsRecipient* out)

bool parseBitcoinURI(QString uri, SendCoinsRecipient* out)
{
// Convert pivx:// to pivx:
// Convert rapids:// to rapids:
//
// Cannot handle this later, because pivx:// will cause Qt to see the part after // as host,
// Cannot handle this later, because rapids:// will cause Qt to see the part after // as host,
// which will lower-case it (and thus invalidate the address).
if (uri.startsWith(URI_SCHEME "://", Qt::CaseInsensitive)) {
uri.replace(0, std::strlen(URI_SCHEME) + 3, URI_SCHEME ":");
Expand Down
2 changes: 1 addition & 1 deletion src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void setupAmountWidget(QLineEdit* widget, QWidget* parent);
// Update the cursor of the widget after a text change
void updateWidgetTextAndCursorPosition(QLineEdit* widget, const QString& str);

// Parse "pivx:" URI into recipient object, return true on successful parsing
// Parse "rapids:" URI into recipient object, return true on successful parsing
bool parseBitcoinURI(const QUrl& uri, SendCoinsRecipient* out);
bool parseBitcoinURI(QString uri, SendCoinsRecipient* out);
QString formatBitcoinURI(const SendCoinsRecipient& info);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/locale/pivx_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ Adresse: %4
<translation>Ungültige Zahlungsaufforderungsadresse %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Kann PIVX nicht starten: click-to-pay Handler</translation>
</message>
<message>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/locale/pivx_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,7 @@ Address: %4
</message>
<message>
<location line="-101"/>
<source>Cannot start pivx: click-to-pay handler</source>
<source>Cannot start rapids: click-to-pay handler</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2178,8 +2178,8 @@ Address: %4
<translation>Invalid payment address %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>Cannot start pivx: click-to-pay handler</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Cannot start rapids: click-to-pay handler</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2173,8 +2173,8 @@ Dirección: %4
<translation>Dirección de pago inválida %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>No se puede iniciar pivx: módulo click-to-pay</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>No se puede iniciar rapids: módulo click-to-pay</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_es_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2107,8 +2107,8 @@ Dirección: %4
<translation>Dirección de pago inválida %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>No se puede iniciar pivx: módulo click-to-pay</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>No se puede iniciar rapids: módulo click-to-pay</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_fr_FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2174,8 +2174,8 @@ Adresse : %4
<translation>Adresse de paiement invalide %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>Impossible de démarrer pivx: gestionnaire click-to-pay</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Impossible de démarrer rapids: gestionnaire click-to-pay</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_hr_HR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2122,8 +2122,8 @@ Adresa: %4
<translation>Nevažeća adresa za plaćanje %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>Ne može se pokrenuti pivx: clik-to-pay handler</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Ne može se pokrenuti rapids: clik-to-pay handler</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2178,8 +2178,8 @@ Indirizzo: %4
<translation>Indirizzo di pagamento %1 invalido</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>Impossibile avviare pivx: gestore click-to-pay</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Impossibile avviare rapids: gestore click-to-pay</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/locale/pivx_ko_KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ Address: %4
<translation>잘못된 결제 주소 %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>PIVX을 시작할 수 없습니다: 결제하기 위한 클릭 처리</translation>
</message>
<message>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/locale/pivx_nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ Adres: %4
<translation>Ongeldig betalingsadres %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Kan pivx niet starten: click-to-pay handler</translation>
</message>
<message>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2022,8 +2022,8 @@ Adres: %4
<translation>Nieprawidłowy adres płatności %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>Nie można uruchomić pivx: click-to-pay handler</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Nie można uruchomić rapids: click-to-pay handler</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2170,8 +2170,8 @@ Address: %4
<translation>Неверный адрес оплаты %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>Не удалось запустить pivx: обработчик click-to-pay </translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Не удалось запустить rapids: обработчик click-to-pay </translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/locale/pivx_tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ Adres: %4
<translation>Geçersiz ödeme adresi %1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>Pivx başlatılamıyor: tıkla ve ödeme işleyicisi</translation>
</message>
<message>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/pivx_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2026,8 +2026,8 @@ Address: %4
<translation>无效支付地址%1</translation>
</message>
<message>
<source>Cannot start pivx: click-to-pay handler</source>
<translation>无法启动pivx:点击支付处理程序</translation>
<source>Cannot start rapids: click-to-pay handler</source>
<translation>无法启动rapids:点击支付处理程序</translation>
</message>
<message>
<source>URI cannot be parsed! This can be caused by an invalid PIVX address or malformed URI parameters.</source>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/openuridialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OpenURIDialog::OpenURIDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystem
{
ui->setupUi(this);
this->setStyleSheet(parent->styleSheet());
ui->uriEdit->setPlaceholderText("pivx:");
ui->uriEdit->setPlaceholderText("rapids:");

ui->labelSubtitle->setText("URI");
setCssProperty(ui->labelSubtitle, "text-title2-dialog");
Expand Down
18 changes: 9 additions & 9 deletions src/qt/paymentserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@


const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("pivx:");
const QString BITCOIN_IPC_PREFIX("rapids:");
// BIP70 payment protocol messages
const char* BIP70_MESSAGE_PAYMENTACK = "PaymentACK";
const char* BIP70_MESSAGE_PAYMENTREQUEST = "PaymentRequest";
Expand Down Expand Up @@ -183,11 +183,11 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
if (arg.startsWith("-"))
continue;

// If the pivx: URI contains a payment request, we are not able to detect the
// If the rapids: URI contains a payment request, we are not able to detect the
// network as that would require fetching and parsing the payment request.
// That means clicking such an URI which contains a testnet payment request
// will start a mainnet instance and throw a "wrong network" error.
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // pivx: URI
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // rapids: URI
{
savedPaymentRequests.append(arg);

Expand Down Expand Up @@ -267,7 +267,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : QObject(p
GOOGLE_PROTOBUF_VERIFY_VERSION;

// Install global event filter to catch QFileOpenEvents
// on Mac: sent when you click pivx: links
// on Mac: sent when you click rapids: links
// other OSes: helpful when dealing with payment request files (in the future)
if (parent)
parent->installEventFilter(this);
Expand All @@ -283,7 +283,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : QObject(p
if (!uriServer->listen(name)) {
// constructor is called early in init, so don't use "emit message()" here
QMessageBox::critical(0, tr("Payment request error"),
tr("Cannot start pivx: click-to-pay handler"));
tr("Cannot start rapids: click-to-pay handler"));
} else {
connect(uriServer, &QLocalServer::newConnection, this, &PaymentServer::handleURIConnection);
connect(this, &PaymentServer::receivedPaymentACK, this, &PaymentServer::handlePaymentACK);
Expand All @@ -297,12 +297,12 @@ PaymentServer::~PaymentServer()
}

//
// OSX-specific way of handling pivx: URIs and
// OSX-specific way of handling rapids: URIs and
// PaymentRequest mime types
//
bool PaymentServer::eventFilter(QObject* object, QEvent* event)
{
// clicking on pivx: URIs creates FileOpen events on the Mac
// clicking on rapids: URIs creates FileOpen events on the Mac
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
if (!fileEvent->file().isEmpty())
Expand All @@ -323,7 +323,7 @@ void PaymentServer::initNetManager()
if (netManager != NULL)
delete netManager;

// netManager is used to fetch paymentrequests given in pivx: URIs
// netManager is used to fetch paymentrequests given in rapids: URIs
netManager = new QNetworkAccessManager(this);

QNetworkProxy proxy;
Expand Down Expand Up @@ -358,7 +358,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
return;
}

if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // pivx: URI
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // rapids: URI
{
QUrlQuery uri((QUrl(s)));
if (uri.hasQueryItem("r")) // payment request URI
Expand Down
2 changes: 1 addition & 1 deletion src/qt/paymentserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define BITCOIN_QT_PAYMENTSERVER_H

// This class handles payment requests from clicking on
// pivx: URIs
// rapids: URIs
//
// This is somewhat tricky, because we have to deal with
// the situation where the user clicks on a link during
Expand Down
2 changes: 1 addition & 1 deletion src/qt/rapids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ int main(int argc, char* argv[])
exit(0);

// Start up the payment server early, too, so impatient users that click on
// pivx: links repeatedly have their payment requests routed to this process:
// rapids: links repeatedly have their payment requests routed to this process:
app.createPaymentServer();
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/qt/recentrequeststablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class RecentRequestEntryLessThan
Qt::SortOrder order;
};

/** Model for list of recently generated payment requests / pivx: URIs.
/** Model for list of recently generated payment requests / rapids: URIs.
* Part of wallet model.
*/
class RecentRequestsTableModel : public QAbstractTableModel
Expand Down
22 changes: 11 additions & 11 deletions src/qt/test/uritests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,54 @@ void URITests::uriTests()
{
SendCoinsRecipient rv;
QUrl uri;
uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?req-dontexist="));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?req-dontexist="));
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?dontexist="));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?dontexist="));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.label == QString());
QVERIFY(rv.amount == 0);

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?label=Some Example Address"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?label=Some Example Address"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.label == QString("Some Example Address"));
QVERIFY(rv.amount == 0);

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=0.001"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=0.001"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.label == QString());
QVERIFY(rv.amount == 100000);

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=1.001"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=1.001"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.label == QString());
QVERIFY(rv.amount == 100100000);

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=100&label=Some Example"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=100&label=Some Example"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.amount == 10000000000LL);
QVERIFY(rv.label == QString("Some Example"));

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?message=Some Example Address"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?message=Some Example Address"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.label == QString());

QVERIFY(GUIUtil::parseBitcoinURI("pivx://D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?message=Some Example Address", &rv));
QVERIFY(GUIUtil::parseBitcoinURI("rapids://D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?message=Some Example Address", &rv));
QVERIFY(rv.address == QString("D72dLgywmL73JyTwQBfuU29CADz9yCJ99v"));
QVERIFY(rv.label == QString());

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?req-message=Some Example Address"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?req-message=Some Example Address"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=1,000&label=Some Example"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=1,000&label=Some Example"));
QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));

uri.setUrl(QString("pivx:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=1,000.0&label=Some Example"));
uri.setUrl(QString("rapids:D72dLgywmL73JyTwQBfuU29CADz9yCJ99v?amount=1,000.0&label=Some Example"));
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
}
2 changes: 1 addition & 1 deletion src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction& tran
std::string value;
rcp.paymentRequest.SerializeToString(&value);
newTx->vOrderForm.push_back(std::make_pair(key, value));
} else if (!rcp.message.isEmpty()) // Message from normal pivx:URI (pivx:XyZ...?message=example)
} else if (!rcp.message.isEmpty()) // Message from normal rapids:URI (rapids:XyZ...?message=example)
{
newTx->vOrderForm.push_back(std::make_pair("Message", rcp.message.toStdString()));
}
Expand Down

0 comments on commit 9006422

Please sign in to comment.