Skip to content

Commit

Permalink
Spark fee calculation fix (#1424)
Browse files Browse the repository at this point in the history
  • Loading branch information
levonpetrosyan93 authored Apr 27, 2024
1 parent 8819b89 commit fb1c99f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog, bool a
{
if (anonymousMode) {
if(spark::IsSparkAllowed()) {
// 924 is constant part, mainly Schnorr and Range proofs, 2535 is for each grootle proof/aux data
// 213 for each private output, 144 other parts of tx,
nBytes = 924 + 2535 * (vOutputs.size()) + 213 * CoinControlDialog::payAmounts.size() + 144;
// 924 is constant part, mainly Schnorr and Range proofs, 1803 is for each grootle proof/aux data
// 213 for each private output,
nBytes = 924 + 1803 * (vOutputs.size()) + 322 * CoinControlDialog::payAmounts.size();
} else {
// 1054 is constant part, mainly Schnorr and Range proofs, 2560 is for each sigma/aux data
// 83 assuming 1 jmint, 34 is the size of each normal vout, 10 is the size of empty transaction, 52 other constant parts
Expand Down
6 changes: 3 additions & 3 deletions src/spark/sparkwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1697,9 +1697,9 @@ std::pair<CAmount, std::vector<CSparkMintMeta>> CSparkWallet::SelectSparkCoins(
throw std::invalid_argument(_("Unable to select cons for spend"));
}

// 924 is constant part, mainly Schnorr and Range proofs, 2535 is for each grootle proof/aux data
// 213 for each private output, 144 other parts of tx,
size = 924 + 2535 * (spendCoins.size()) + 213 * mintNum + 144; //TODO (levon) take in account also utxoNum
// 1803 is for first grootle proof/aux data
// 213 for each private output, 34 for each utxo,924 constant parts of tx parts of tx,
size = 924 + 1803*(spendCoins.size()) + 322*(mintNum+1) + 34*utxoNum;
CAmount feeNeeded = CWallet::GetMinimumFee(size, nTxConfirmTarget, mempool);

if (fee >= feeNeeded) {
Expand Down

0 comments on commit fb1c99f

Please sign in to comment.