mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #8288: qt: Network-specific example address
4f44cb6
qt: Network-specific example address (Wladimir J. van der Laan)
This commit is contained in:
parent
355f3724d2
commit
25627e31dd
@ -109,6 +109,23 @@ QFont fixedPitchFont()
|
||||
#endif
|
||||
}
|
||||
|
||||
// Just some dummy data to generate an convincing random-looking (but consistent) address
|
||||
static const uint8_t dummydata[] = {0xeb,0x15,0x23,0x1d,0xfc,0xeb,0x60,0x92,0x58,0x86,0xb6,0x7d,0x06,0x52,0x99,0x92,0x59,0x15,0xae,0xb1,0x72,0xc0,0x66,0x47};
|
||||
|
||||
// Generate a dummy address with invalid CRC, starting with the network prefix.
|
||||
static std::string DummyAddress(const CChainParams ¶ms)
|
||||
{
|
||||
std::vector<unsigned char> sourcedata = params.Base58Prefix(CChainParams::PUBKEY_ADDRESS);
|
||||
sourcedata.insert(sourcedata.end(), dummydata, dummydata + sizeof(dummydata));
|
||||
for(int i=0; i<256; ++i) { // Try every trailing byte
|
||||
std::string s = EncodeBase58(begin_ptr(sourcedata), end_ptr(sourcedata));
|
||||
if (!CBitcoinAddress(s).IsValid())
|
||||
return s;
|
||||
sourcedata[sourcedata.size()-1] += 1;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
|
||||
{
|
||||
parent->setFocusProxy(widget);
|
||||
@ -117,7 +134,8 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
|
||||
#if QT_VERSION >= 0x040700
|
||||
// We don't want translators to use own addresses in translations
|
||||
// and this is the only place, where this address is supplied.
|
||||
widget->setPlaceholderText(QObject::tr("Enter a Dash address (e.g. %1)").arg("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg"));
|
||||
widget->setPlaceholderText(QObject::tr("Enter a Dash address (e.g. %1)").arg(
|
||||
QString::fromStdString(DummyAddress(Params()))));
|
||||
#endif
|
||||
widget->setValidator(new BitcoinAddressEntryValidator(parent));
|
||||
widget->setCheckValidator(new BitcoinAddressCheckValidator(parent));
|
||||
|
Loading…
Reference in New Issue
Block a user