diff --git a/src/hdmint/hdmint.h b/src/hdmint/hdmint.h index 0b155751b3..7795a68722 100644 --- a/src/hdmint/hdmint.h +++ b/src/hdmint/hdmint.h @@ -45,9 +45,9 @@ class CHDMint uint256 GetPubCoinHash() const { return primitives::GetPubCoinValueHash(pubCoinValue); } uint256 GetTxHash() const { return txid; } bool IsUsed() const { return isUsed; } - void SetAmount(const int64_t& amount) { this->amount = amount; } - void SetHeight(const int& nHeight) { this->nHeight = nHeight; } - void SetId(const int& nId) { this->nId = nId; } + void SetAmount(int64_t amount) { this->amount = amount; } + void SetHeight(int nHeight) { this->nHeight = nHeight; } + void SetId(int nId) { this->nId = nId; } void SetNull(); void SetTxHash(const uint256& txid) { this->txid = txid; } void SetUsed(const bool isUsed) { this->isUsed = isUsed; } diff --git a/src/hdmint/wallet.cpp b/src/hdmint/wallet.cpp index ef29b1386c..6b0305cf68 100644 --- a/src/hdmint/wallet.cpp +++ b/src/hdmint/wallet.cpp @@ -446,7 +446,7 @@ void CHDMintWallet::SyncWithChain(bool fGenerateMintPool, boost::optional mintPoolEntryPair, const int& nHeight, const uint256& txid, const sigma::CoinDenomination& denom) +bool CHDMintWallet::SetMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, int nHeight, const uint256& txid, const sigma::CoinDenomination& denom) { // Regenerate the mint uint256 hashPubcoin = mintPoolEntryPair.first; @@ -487,12 +487,17 @@ bool CHDMintWallet::SetMintSeedSeen(CWalletDB& walletdb, std::pairGetMintedCoinHeightAndId(sigma::PublicCoin(bnValue, denom)); + // Create mint object CHDMint dMint(mintCount, seedId, hashSerial, bnValue); int64_t amount; DenominationToInteger(denom, amount); dMint.SetAmount(amount); dMint.SetHeight(nHeight); + dMint.SetId(id); // Check if this is also already spent int nHeightTx; @@ -519,7 +524,7 @@ bool CHDMintWallet::SetMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, const int& nHeight, const uint256& txid, const uint64_t amount) +bool CHDMintWallet::SetLelantusMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, int nHeight, const uint256& txid, uint64_t amount) { // Regenerate the mint uint256 hashPubcoin = mintPoolEntryPair.first; diff --git a/src/hdmint/wallet.h b/src/hdmint/wallet.h index 2ec124219c..4506fd24b9 100644 --- a/src/hdmint/wallet.h +++ b/src/hdmint/wallet.h @@ -45,8 +45,8 @@ class CHDMintWallet bool TxOutToPublicCoin(const CTxOut& txout, sigma::PublicCoin& pubCoin, CValidationState& state); std::pair RegenerateMintPoolEntry(CWalletDB& walletdb, const uint160& mintHashSeedMaster, CKeyID& seedId, const int32_t& nCount); void GenerateMintPool(CWalletDB& walletdb, int32_t nIndex = 0); - bool SetMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, const int& nHeight, const uint256& txid, const sigma::CoinDenomination& denom); - bool SetLelantusMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, const int& nHeight, const uint256& txid, const uint64_t amount); + bool SetMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, int nHeight, const uint256& txid, const sigma::CoinDenomination& denom); + bool SetLelantusMintSeedSeen(CWalletDB& walletdb, std::pair mintPoolEntryPair, int nHeight, const uint256& txid, uint64_t amount); bool SeedToMint(const uint512& mintSeed, GroupElement& bnValue, sigma::PrivateCoin& coin); bool SeedToLelantusMint(const uint512& mintSeed, lelantus::PrivateCoin& coin); diff --git a/src/wallet/lelantusjoinsplitbuilder.cpp b/src/wallet/lelantusjoinsplitbuilder.cpp index 55633d3e88..0da7378aa6 100644 --- a/src/wallet/lelantusjoinsplitbuilder.cpp +++ b/src/wallet/lelantusjoinsplitbuilder.cpp @@ -426,7 +426,7 @@ void LelantusJoinSplitBuilder::CreateJoinSplit( std::tie(std::ignore, groupId) = state->GetMintedCoinHeightAndId(pub); if (groupId < 0) { - throw std::runtime_error(_("One of minted coin does not found in the chain")); + throw std::runtime_error(_("One of the lelantus coins has not been found in the chain!")); } coins.emplace_back(make_pair(priv, groupId)); @@ -468,8 +468,8 @@ void LelantusJoinSplitBuilder::CreateJoinSplit( std::tie(std::ignore, groupId) = sigmaState->GetMintedCoinHeightAndId(pub); - if (groupId < 0 || groupId != spend.id) { - throw std::runtime_error(_("One of minted coin does not found in the chain")); + if (groupId < 0) { + throw std::runtime_error(_("One of the sigma coins has not been found in the chain!")); } //this way we are remembering denomination and group id in one field as we have no demomination in Lelantus diff --git a/src/wallet/sigmaspendbuilder.cpp b/src/wallet/sigmaspendbuilder.cpp index 03f8879a62..7ff6e4d194 100644 --- a/src/wallet/sigmaspendbuilder.cpp +++ b/src/wallet/sigmaspendbuilder.cpp @@ -88,7 +88,7 @@ static std::unique_ptr CreateSigner(const CSigmaEntry& coin) std::tie(std::ignore, groupId) = state->GetMintedCoinHeightAndId(pub); if (groupId < 0) { - throw std::runtime_error(_("One of minted coin does not found in the chain")); + throw std::runtime_error(_("One of the sigma coins has not been found in the chain!")); } signer->output.n = static_cast(groupId);