Show wallet address in error messages and status
This commit is contained in:
+22
-7
@@ -24,25 +24,40 @@ namespace p2pool {
|
||||
class Wallet
|
||||
{
|
||||
public:
|
||||
// public keys: 64 bytes -> 88 characters in base58
|
||||
// prefix (1 byte) + checksum (4 bytes) -> 7 characters in base58
|
||||
// 95 characters in total
|
||||
static constexpr int ADDRESS_LENGTH = 95;
|
||||
|
||||
explicit Wallet(const char* address);
|
||||
|
||||
Wallet(const Wallet& w);
|
||||
Wallet& operator=(const Wallet& w);
|
||||
|
||||
FORCEINLINE bool valid() const { return m_type != NetworkType::Invalid; }
|
||||
FORCEINLINE NetworkType type() const { return m_type; }
|
||||
|
||||
bool decode(const char* address);
|
||||
bool assign(const hash& spend_pub_key, const hash& view_pub_key, NetworkType type);
|
||||
|
||||
void encode(char (&buf)[ADDRESS_LENGTH]) const;
|
||||
|
||||
FORCEINLINE std::string encode() const
|
||||
{
|
||||
char buf[ADDRESS_LENGTH];
|
||||
encode(buf);
|
||||
return std::string(buf, buf + ADDRESS_LENGTH);
|
||||
}
|
||||
|
||||
bool get_eph_public_key(const hash& txkey_sec, size_t output_index, hash& eph_public_key, uint8_t& view_tag, const uint8_t* expected_view_tag = nullptr) const;
|
||||
|
||||
FORCEINLINE bool operator<(const Wallet& w) const { return (m_spendPublicKey < w.m_spendPublicKey) || ((m_spendPublicKey == w.m_spendPublicKey) && (m_viewPublicKey < w.m_viewPublicKey)); }
|
||||
FORCEINLINE bool operator==(const Wallet& w) const { return (m_spendPublicKey == w.m_spendPublicKey) && (m_viewPublicKey == w.m_viewPublicKey); }
|
||||
|
||||
FORCEINLINE uint64_t prefix() const { return m_prefix; }
|
||||
FORCEINLINE const hash& spend_public_key() const { return m_spendPublicKey; }
|
||||
FORCEINLINE const hash& view_public_key() const { return m_viewPublicKey; }
|
||||
|
||||
bool get_eph_public_key(const hash& txkey_sec, size_t output_index, hash& eph_public_key, uint8_t& view_tag) const;
|
||||
bool get_eph_public_key_with_view_tag(const hash& txkey_sec, size_t output_index, hash& eph_public_key, uint8_t expected_view_tag) const;
|
||||
|
||||
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; }
|
||||
FORCEINLINE uint32_t checksum() const { return m_checksum; }
|
||||
FORCEINLINE NetworkType type() const { return m_type; }
|
||||
|
||||
private:
|
||||
uint64_t m_prefix;
|
||||
|
||||
Reference in New Issue
Block a user