Skip to content

Commit 680643d

Browse files
AI comments resolved
1 parent b065d5f commit 680643d

File tree

7 files changed

+39
-37
lines changed

7 files changed

+39
-37
lines changed

src/batchproof_container.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,16 @@ void BatchProofContainer::removeLelantus(std::unordered_map<Scalar, int> spentSe
7474
int id = spendSerial.second;
7575

7676
// afterFixes bool with the pair of set id is considered separate set identifiers, so try to find in one set, if not found try also in another
77-
std::pair<uint32_t, bool> key = std::make_pair(id, false);
77+
std::pair<uint32_t, bool> key1 = std::make_pair(id, false);
78+
std::pair<uint32_t, bool> key2 = std::make_pair(id, true);
7879
std::vector<LelantusSigmaProofData>* vProofs;
79-
if (lelantusSigmaProofs.count(key) > 0) {
80-
vProofs = &lelantusSigmaProofs[key];
80+
if (lelantusSigmaProofs.count(key1) > 0) {
81+
vProofs = &lelantusSigmaProofs[key1];
82+
erase(vProofs, spendSerial.first);
83+
}
84+
85+
if (lelantusSigmaProofs.count(key2) > 0) {
86+
vProofs = &lelantusSigmaProofs[key2];
8187
erase(vProofs, spendSerial.first);
8288
}
8389
}

src/qt/automintmodel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void IncomingFundNotifier::check()
5555
return;
5656

5757
// update only if there are transaction and last update was done more than 2 minutes ago, and in case it is first time
58-
if ((lastUpdateTime!= 0 && (GetSystemTimeInSeconds() - lastUpdateTime <= 120))) {
58+
if (txs.empty() || (lastUpdateTime!= 0 && (GetSystemTimeInSeconds() - lastUpdateTime <= 120))) {
5959
return;
6060
}
6161

@@ -91,8 +91,12 @@ void IncomingFundNotifier::check()
9191
}
9292
}
9393

94-
credit = pwalletMain->GetaAvailableCoinsForLMint();
94+
std::vector<std::pair<CAmount, std::vector<COutput>>> valueAndUTXOs;
95+
pwalletMain->AvailableCoinsForLMint(valueAndUTXOs, &coinControl);
9596

97+
for (auto const &valueAndUTXO : valueAndUTXOs) {
98+
credit += valueAndUTXO.first;
99+
}
96100
}
97101

98102
for (auto const &tx : immatures) {

src/qt/sparkmodel.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,24 @@ SparkModel::~SparkModel()
3535

3636
CAmount SparkModel::getMintableSparkAmount()
3737
{
38-
CAmount credit = 0;
38+
std::vector<std::pair<CAmount, std::vector<COutput>>> valueAndUTXO;
3939
{
4040
TRY_LOCK(cs_main,lock_main);
4141
if (!lock_main)
4242
return cachedMintableSparkAmount;
4343
TRY_LOCK(wallet->cs_wallet,lock_wallet);
4444
if (!lock_wallet)
4545
return cachedMintableSparkAmount;
46-
credit = pwalletMain->GetaAvailableCoinsForLMint();
46+
pwalletMain->AvailableCoinsForLMint(valueAndUTXO, nullptr);
4747
}
4848

49-
cachedMintableSparkAmount = credit;
50-
return credit;
49+
CAmount s = 0;
50+
for (auto const &val : valueAndUTXO) {
51+
s += val.first;
52+
}
53+
54+
cachedMintableSparkAmount = s;
55+
return s;
5156
}
5257

5358
AutoMintSparkModel* SparkModel::getAutoMintSparkModel()

src/test/lelantus_mintspend_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(lelantus_mintspend_test)
7676
CWalletTx result;
7777
{
7878
std::vector<CHDMint> mintCoins; // new mints
79-
CAmount fee;
79+
CAmount fee = 0;
8080
result = pwalletMain->CreateLelantusJoinSplitTransaction(recipients, fee, {}, spendCoins, mintCoins);
8181
pwalletMain->CommitLelantusTransaction(result, spendCoins, mintCoins);
8282
}
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(lelantus_mintspend_test)
104104
result.Init(NULL);
105105
{
106106
std::vector<CHDMint> mintCoins; // new mints
107-
CAmount fee;
107+
CAmount fee = 0;
108108
result = pwalletMain->CreateLelantusJoinSplitTransaction(recipients, fee, {}, spendCoins, mintCoins);
109109
pwalletMain->CommitLelantusTransaction(result, spendCoins, mintCoins);
110110
}

src/wallet/rpcwallet.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5263,19 +5263,19 @@ static const CRPCCommand commands[] =
52635263
{ "wallet", "walletpassphrase", &walletpassphrase, true, {"passphrase","timeout"} },
52645264
{ "wallet", "removeprunedfunds", &removeprunedfunds, true, {"txid"} },
52655265

5266-
{ "wallet", "listunspentlelantusmints", &listunspentlelantusmints, false },
5267-
{ "wallet", "mintlelantus", &mintlelantus, false },
5268-
{ "wallet", "autoMintlelantus", &autoMintlelantus, false },
5269-
{ "wallet", "joinsplit", &joinsplit, false },
5270-
{ "wallet", "resetlelantusmint", &resetlelantusmint, false },
5271-
{ "wallet", "setlelantusmintstatus", &setlelantusmintstatus, false },
5272-
{ "wallet", "listlelantusmints", &listlelantusmints, false },
5273-
5274-
{ "wallet", "setmininput", &setmininput, false },
5275-
{ "wallet", "regeneratemintpool", &regeneratemintpool, false },
5276-
{ "wallet", "removetxmempool", &removetxmempool, false },
5277-
{ "wallet", "removetxwallet", &removetxwallet, false },
5278-
{ "wallet", "listlelantusjoinsplits", &listlelantusjoinsplits, false },
5266+
{ "wallet", "listunspentlelantusmints", &listunspentlelantusmints, false, {} },
5267+
{ "wallet", "mintlelantus", &mintlelantus, false, {} },
5268+
{ "wallet", "autoMintlelantus", &autoMintlelantus, false, {} },
5269+
{ "wallet", "joinsplit", &joinsplit, false, {} },
5270+
{ "wallet", "resetlelantusmint", &resetlelantusmint, false, {} },
5271+
{ "wallet", "setlelantusmintstatus", &setlelantusmintstatus, false, {} },
5272+
{ "wallet", "listlelantusmints", &listlelantusmints, false, {} },
5273+
5274+
{ "wallet", "setmininput", &setmininput, false, {} },
5275+
{ "wallet", "regeneratemintpool", &regeneratemintpool, false, {} },
5276+
{ "wallet", "removetxmempool", &removetxmempool, false, {} },
5277+
{ "wallet", "removetxwallet", &removetxwallet, false, {} },
5278+
{ "wallet", "listlelantusjoinsplits", &listlelantusjoinsplits, false, {} },
52795279

52805280
//spark
52815281
{ "wallet", "listunspentsparkmints", &listunspentsparkmints, false, {} },

src/wallet/wallet.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,15 +1293,6 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
12931293
// Break debit/credit balance caches:
12941294
wtx.MarkDirty();
12951295

1296-
std::uint64_t credit = 0;
1297-
std::vector<std::pair<CAmount, std::vector<COutput>>> valueAndUTXOs;
1298-
pwalletMain->AvailableCoinsForLMint(valueAndUTXOs, NULL);
1299-
for (auto const &valueAndUTXO : valueAndUTXOs) {
1300-
credit += valueAndUTXO.first;
1301-
}
1302-
1303-
availableCoinsForLMint = credit;
1304-
13051296
// Notify UI of new or updated transaction
13061297
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
13071298

src/wallet/wallet.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,10 +822,6 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
822822

823823
std::set<COutPoint> setLockedCoins;
824824

825-
std::uint64_t availableCoinsForLMint = 0;
826-
827-
std::uint64_t GetaAvailableCoinsForLMint() {return availableCoinsForLMint;}
828-
829825
const CWalletTx* GetWalletTx(const uint256& hash) const;
830826

831827
//! check whether we are allowed to upgrade (or already support) to the named feature

0 commit comments

Comments
 (0)