mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
allow wallet gui to differentiate between different awards (#322)
This commit is contained in:
parent
4c452e8545
commit
2ba498242e
|
@ -92,6 +92,14 @@ std::vector<TransactionInfo *> TransactionHistoryImpl::getAll() const
|
||||||
return m_history;
|
return m_history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static reward_type from_pay_type(tools::pay_type ptype) {
|
||||||
|
switch (ptype) {
|
||||||
|
case tools::pay_type::service_node: return reward_type::service_node;
|
||||||
|
case tools::pay_type::miner: return reward_type::miner;
|
||||||
|
default: reward_type::unspecified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TransactionHistoryImpl::refresh()
|
void TransactionHistoryImpl::refresh()
|
||||||
{
|
{
|
||||||
// multithreaded access:
|
// multithreaded access:
|
||||||
|
@ -136,6 +144,7 @@ void TransactionHistoryImpl::refresh()
|
||||||
ti->m_timestamp = pd.m_timestamp;
|
ti->m_timestamp = pd.m_timestamp;
|
||||||
ti->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
|
ti->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
|
||||||
ti->m_unlock_time = pd.m_unlock_time;
|
ti->m_unlock_time = pd.m_unlock_time;
|
||||||
|
ti->m_reward_type = from_pay_type(pd.m_type);
|
||||||
m_history.push_back(ti);
|
m_history.push_back(ti);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -236,6 +245,7 @@ void TransactionHistoryImpl::refresh()
|
||||||
ti->m_label = m_wallet->m_wallet->get_subaddress_label(pd.m_subaddr_index);
|
ti->m_label = m_wallet->m_wallet->get_subaddress_label(pd.m_subaddr_index);
|
||||||
ti->m_timestamp = pd.m_timestamp;
|
ti->m_timestamp = pd.m_timestamp;
|
||||||
ti->m_confirmations = 0;
|
ti->m_confirmations = 0;
|
||||||
|
ti->m_reward_type = from_pay_type(pd.m_type);
|
||||||
m_history.push_back(ti);
|
m_history.push_back(ti);
|
||||||
|
|
||||||
LOG_PRINT_L1(__FUNCTION__ << ": Unconfirmed payment found " << pd.m_amount);
|
LOG_PRINT_L1(__FUNCTION__ << ": Unconfirmed payment found " << pd.m_amount);
|
||||||
|
|
|
@ -66,6 +66,15 @@ int TransactionInfoImpl::direction() const
|
||||||
return m_direction;
|
return m_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TransactionInfoImpl::isServiceNodeReward() const
|
||||||
|
{
|
||||||
|
return m_reward_type == reward_type::service_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TransactionInfoImpl::isMinerReward() const
|
||||||
|
{
|
||||||
|
return m_reward_type == reward_type::miner;
|
||||||
|
}
|
||||||
|
|
||||||
bool TransactionInfoImpl::isPending() const
|
bool TransactionInfoImpl::isPending() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,12 @@ namespace Monero {
|
||||||
|
|
||||||
class TransactionHistoryImpl;
|
class TransactionHistoryImpl;
|
||||||
|
|
||||||
|
enum class reward_type {
|
||||||
|
unspecified,
|
||||||
|
service_node,
|
||||||
|
miner
|
||||||
|
};
|
||||||
|
|
||||||
class TransactionInfoImpl : public TransactionInfo
|
class TransactionInfoImpl : public TransactionInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -60,11 +66,14 @@ public:
|
||||||
virtual const std::vector<Transfer> &transfers() const override;
|
virtual const std::vector<Transfer> &transfers() const override;
|
||||||
virtual uint64_t confirmations() const override;
|
virtual uint64_t confirmations() const override;
|
||||||
virtual uint64_t unlockTime() const override;
|
virtual uint64_t unlockTime() const override;
|
||||||
|
bool isServiceNodeReward() const override;
|
||||||
|
bool isMinerReward() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_direction;
|
int m_direction;
|
||||||
bool m_pending;
|
bool m_pending;
|
||||||
bool m_failed;
|
bool m_failed;
|
||||||
|
reward_type m_reward_type; // may have a value rather than `unspecified` after hf 10
|
||||||
uint64_t m_amount;
|
uint64_t m_amount;
|
||||||
uint64_t m_fee;
|
uint64_t m_fee;
|
||||||
uint64_t m_blockheight;
|
uint64_t m_blockheight;
|
||||||
|
|
|
@ -178,6 +178,8 @@ struct TransactionInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~TransactionInfo() = 0;
|
virtual ~TransactionInfo() = 0;
|
||||||
|
virtual bool isServiceNodeReward() const = 0;
|
||||||
|
virtual bool isMinerReward() const = 0;
|
||||||
virtual int direction() const = 0;
|
virtual int direction() const = 0;
|
||||||
virtual bool isPending() const = 0;
|
virtual bool isPending() const = 0;
|
||||||
virtual bool isFailed() const = 0;
|
virtual bool isFailed() const = 0;
|
||||||
|
|
Loading…
Reference in a new issue