mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
Stricter wallet address checks
This commit is contained in:
parent
bdb8ce57d0
commit
5eea610f3c
2 changed files with 14 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "p2p_server.h"
|
||||
#include "params.h"
|
||||
#include "console_commands.h"
|
||||
#include "crypto.h"
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -51,6 +52,14 @@ p2pool::p2pool(int argc, char* argv[])
|
|||
panic();
|
||||
}
|
||||
|
||||
hash pub, sec, eph_public_key;
|
||||
generate_keys(pub, sec);
|
||||
|
||||
if (!m_params->m_wallet.get_eph_public_key(sec, 0, eph_public_key)) {
|
||||
LOGERR(1, "Invalid wallet address: get_eph_public_key failed");
|
||||
panic();
|
||||
}
|
||||
|
||||
const NetworkType type = m_params->m_wallet.type();
|
||||
|
||||
if (type == NetworkType::Testnet) {
|
||||
|
|
|
@ -190,6 +190,11 @@ bool Wallet::decode(const char* address)
|
|||
m_type = NetworkType::Invalid;
|
||||
}
|
||||
|
||||
ge_p3 point;
|
||||
if ((ge_frombytes_vartime(&point, m_spendPublicKey.h) != 0) || (ge_frombytes_vartime(&point, m_viewPublicKey.h) != 0)) {
|
||||
m_type = NetworkType::Invalid;
|
||||
}
|
||||
|
||||
return valid();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue