Skip to content

Conversation

@UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Oct 22, 2018

A better way of handling PS fees in cases when no smallest denoms left.

Replaces #1372


//if we're doing only denominated, we need to round up to the nearest smallest denomination
if(nCoinType == ONLY_DENOMINATED) {
if (nCoinType == ONLY_DENOMINATED) {
Copy link
Member

@PastaPastaPasta PastaPastaPasta Oct 22, 2018

Choose a reason for hiding this comment

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

Mixing formatting with code changes? Disappointed... 😛

Copy link
Author

Choose a reason for hiding this comment

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

Good point, shame on me :)


// Try to fit into fee that matches one of denominations, from small to large
for (const auto& nDenomAsAFee : vecDenominationsAsAFee) {
CAmount nMaxPSFee = std::min(nDenomAsAFee, maxTxFee);
Copy link
Member

@PastaPastaPasta PastaPastaPasta Oct 22, 2018

Choose a reason for hiding this comment

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

does validation.h#L61 need to be changed (maxTxFee)?
current

//! -maxtxfee default
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.2 * COIN; // "smallest denom" + X * "denom tails"

Copy link
Author

Choose a reason for hiding this comment

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

Hmmm.. we should've probably reverted #737 (i.e. changed this to 0.1 * COIN which is bitcoin's default) the last time we introduced smaller denom becasue the logic in original PR was no longer relevant even at that moment 🙈This probably deserves its own PR however, since it's not directly connected to changes introduced in this specific PR imo.

Copy link
Member

Choose a reason for hiding this comment

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

see #2362

if (nRounds < privateSendClient.nPrivateSendRounds) continue;
nValueRet += nDenom;
setCoinsRet.insert(std::make_pair(out.tx, out.i));
if (nValueRet >= nTargetValue) return true; // Done, no need to look any further
Copy link
Member

Choose a reason for hiding this comment

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

I'm worried that as we are adding inputs it doesn't appear we are increasing the nTargetValue nor accounting for the fees of the added inputs... Could this fail in a way that the amount of the denoms is enough to cover the amount being sent but not enough to cover the amount + the fee resulting in a tx failing?

Copy link
Author

Choose a reason for hiding this comment

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

I was thinking about this and no, technically, this should be good. But then I realised that even in this case we are probably doing it wrong (it's not the job of SelectCoins to guess fees/pick the best set). So, it was a very good question actually :) Pls see #2371 for an alternative solution.

@UdjinM6
Copy link
Author

UdjinM6 commented Oct 24, 2018

closing in fav of #2371

@UdjinM6 UdjinM6 closed this Oct 24, 2018
@UdjinM6 UdjinM6 deleted the bumppsfee branch November 26, 2020 13:25
@UdjinM6 UdjinM6 removed this from the 13.0 milestone Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants