2021-08-22 04:20:59 -06:00
|
|
|
/*
|
|
|
|
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
|
|
|
* Copyright (c) 2021 SChernykh <https://github.com/SChernykh>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "uv_util.h"
|
|
|
|
|
|
|
|
namespace p2pool {
|
|
|
|
|
|
|
|
class Wallet
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Wallet(const char* address);
|
|
|
|
~Wallet();
|
|
|
|
|
|
|
|
Wallet(const Wallet& w);
|
|
|
|
Wallet& operator=(const Wallet& w);
|
|
|
|
|
2021-08-27 03:25:25 -06:00
|
|
|
FORCEINLINE bool valid() const { return m_type != NetworkType::Invalid; }
|
|
|
|
FORCEINLINE NetworkType type() const { return m_type; }
|
2021-08-22 04:20:59 -06:00
|
|
|
|
|
|
|
bool decode(const char* address);
|
2021-08-31 09:23:20 -06:00
|
|
|
bool assign(const hash& spend_pub_key, const hash& view_pub_key, NetworkType type);
|
2021-08-22 04:20:59 -06:00
|
|
|
|
|
|
|
FORCEINLINE const hash& spend_public_key() const { return m_spendPublicKey; }
|
|
|
|
FORCEINLINE const hash& view_public_key() const { return m_viewPublicKey; }
|
|
|
|
|
2021-09-14 03:06:49 -06:00
|
|
|
bool get_eph_public_key(const hash& txkey_sec, size_t output_index, hash& eph_public_key) const;
|
2021-08-22 04:20:59 -06:00
|
|
|
|
|
|
|
FORCEINLINE bool operator<(const Wallet& w) const { return m_spendPublicKey < w.m_spendPublicKey; }
|
|
|
|
FORCEINLINE bool operator==(const Wallet& w) const { return m_spendPublicKey == w.m_spendPublicKey; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint64_t m_prefix;
|
|
|
|
hash m_spendPublicKey;
|
|
|
|
hash m_viewPublicKey;
|
|
|
|
uint32_t m_checksum;
|
2021-08-27 03:25:25 -06:00
|
|
|
NetworkType m_type;
|
2021-08-22 04:20:59 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace p2pool
|