mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Merge pull request #1386 from darcys22/api-list-stakes
Api for staked amount on pending transactions
This commit is contained in:
commit
7b882ac5ae
4 changed files with 17 additions and 0 deletions
|
@ -163,6 +163,15 @@ uint64_t PendingTransactionImpl::amount() const
|
|||
for (const auto &dest : ptx.dests) {
|
||||
result += dest.amount;
|
||||
}
|
||||
service_nodes::staking_components sc;
|
||||
uint64_t height = m_wallet.blockChainHeight();
|
||||
std::optional<uint8_t> hf_version = m_wallet.hardForkVersion();
|
||||
if (hf_version)
|
||||
{
|
||||
if (service_nodes::tx_get_staking_components_and_amounts(static_cast<cryptonote::network_type>(m_wallet.nettype()), *hf_version, ptx.tx, height, &sc)
|
||||
&& sc.transferred > 0)
|
||||
result = sc.transferred;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2417,6 +2417,12 @@ void WalletImpl::hardForkInfo(uint8_t &version, uint64_t &earliest_height) const
|
|||
m_wallet->get_hard_fork_info(version, earliest_height);
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::optional<uint8_t> WalletImpl::hardForkVersion() const
|
||||
{
|
||||
m_wallet->get_hard_fork_version();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool WalletImpl::useForkRules(uint8_t version, int64_t early_blocks) const
|
||||
{
|
||||
|
|
|
@ -120,6 +120,7 @@ public:
|
|||
bool rescanSpent() override;
|
||||
NetworkType nettype() const override {return static_cast<NetworkType>(m_wallet->nettype());}
|
||||
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override;
|
||||
std::optional<uint8_t> hardForkVersion() const override;
|
||||
bool useForkRules(uint8_t version, int64_t early_blocks) const override;
|
||||
|
||||
void addSubaddressAccount(const std::string& label) override;
|
||||
|
|
|
@ -454,6 +454,7 @@ struct Wallet
|
|||
bool devnet() const { return nettype() == DEVNET; }
|
||||
//! returns current hard fork info
|
||||
virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0;
|
||||
virtual std::optional<uint8_t> hardForkVersion() const = 0;
|
||||
//! check if hard fork rules should be used
|
||||
virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0;
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue