mirror of
https://github.com/feather-wallet/feather.git
synced 2025-04-13 16:31:55 +00:00
AddressChecker: add torsion check
This commit is contained in:
parent
1c6bd9815b
commit
c34ad819a6
3 changed files with 16 additions and 0 deletions
src
|
@ -1388,6 +1388,11 @@ void MainWindow::showAddressChecker() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!m_wallet->isAddressTorsionFree(address)) {
|
||||
Utils::showWarning(this, "Address is not torsion-free", "This address is not compatible with reference wallets.\n\nSending to this address MAY RESULT IN A LOSS OF FUNDS.");
|
||||
return;
|
||||
}
|
||||
|
||||
SubaddressIndex index = m_wallet->subaddressIndex(address);
|
||||
if (!index.isValid()) {
|
||||
// TODO: probably mention lookahead here
|
||||
|
|
|
@ -331,6 +331,15 @@ QString Wallet::getSubaddressLookahead() const {
|
|||
return QString("%1:%2").arg(QString::number(lookahead.first), QString::number(lookahead.second));
|
||||
}
|
||||
|
||||
bool Wallet::isAddressTorsionFree(const QString& address) {
|
||||
cryptonote::address_parse_info info;
|
||||
bool r = cryptonote::get_account_address_from_str(info, m_wallet2->nettype(), address.toStdString());
|
||||
if (!r) {
|
||||
return false;
|
||||
}
|
||||
return rct::isInMainSubgroup(rct::pk2rct(info.address.m_spend_public_key)) && rct::isInMainSubgroup(rct::pk2rct(info.address.m_view_public_key));
|
||||
}
|
||||
|
||||
// #################### Seed ####################
|
||||
|
||||
QString Wallet::getSeed(const QString &seedOffset) const {
|
||||
|
|
|
@ -176,6 +176,8 @@ public:
|
|||
void deviceShowAddressAsync(quint32 accountIndex, quint32 addressIndex, const QString &paymentId);
|
||||
QString getSubaddressLookahead() const;
|
||||
|
||||
bool isAddressTorsionFree(const QString& address);
|
||||
|
||||
// ##### Seed #####
|
||||
|
||||
//! returns mnemonic seed
|
||||
|
|
Loading…
Reference in a new issue