Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for coin not found issue. #971

Merged
merged 3 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/hdmint/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,17 @@ bool CHDMintWallet::SetMintSeedSeen(CWalletDB& walletdb, std::pair<uint256,MintP
}

LogPrintf("%s: Creating mint object.. \n", __func__);

int id;
std::tie(std::ignore, id) = sigma::CSigmaState::GetState()->GetMintedCoinHeightAndId(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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nHeight is passed to this function as const int & which is something really weird. Please change it to just int

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay,

dMint.SetId(id);

// Check if this is also already spent
int nHeightTx;
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/lelantusjoinsplitbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/sigmaspendbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static std::unique_ptr<SigmaSpendSigner> 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<uint32_t>(groupId);
Expand Down