Skip to content

Commit

Permalink
Add getMintAmount function
Browse files Browse the repository at this point in the history
  • Loading branch information
levonpetrosyan93 committed Jun 7, 2023
1 parent e946fce commit 6a7c0f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/spark/sparkwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@ CSparkMintMeta CSparkWallet::getMintMeta(const secp_primitives::Scalar& nonce) {
return CSparkMintMeta();
}

bool CSparkWallet::getMintAmount(spark::Coin coin, CAmount& amount) {
spark::IdentifiedCoinData identifiedCoinData;
try {
identifiedCoinData = coin.identify(this->viewKey);
} catch (...) {
return false;
}
amount = identifiedCoinData.v;
return true;
}

void CSparkWallet::UpdateSpendState(const GroupElement& lTag, const uint256& lTagHash, const uint256& txHash, bool fUpdateMint) {
if (coinMeta.count(lTagHash)) {
auto mintMeta = coinMeta[lTagHash];
Expand Down
2 changes: 2 additions & 0 deletions src/spark/sparkwallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class CSparkWallet {
// get mint tag from nonce
CSparkMintMeta getMintMeta(const secp_primitives::Scalar& nonce);

bool getMintAmount(spark::Coin coin, CAmount& amount);

bool isMine(spark::Coin coin) const;
bool isMine(const std::vector<GroupElement>& lTags) const;

Expand Down

0 comments on commit 6a7c0f9

Please sign in to comment.