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

[Bug] Calculating private transaction fees. #66

Open
kewde opened this issue Nov 11, 2016 · 4 comments
Open

[Bug] Calculating private transaction fees. #66

kewde opened this issue Nov 11, 2016 · 4 comments

Comments

@kewde
Copy link

kewde commented Nov 11, 2016

When trying to spend the full amount of SDT, it often ends up being a messy procedure with lots of trial and error.

When you lower the amount to accommodate for the fee, it often increases the transaction size causing it to require a larger fee. It's a vicious cycle that eventually stops.

@dasource
Copy link

dasource commented Nov 12, 2016

Maybe spending the dust amount as a fee would clear this up (warn the user before doing so)?
i.e. Take all the inputs and calculate fee = max widthdraw (with largest fee possible) ... on spend send the max withdraw amount + (relevant fee + extra dust) to miner. That should leave you with 0 balance.

@kewde
Copy link
Author

kewde commented Nov 12, 2016

That was initially what I planned on doing, seems like the easiest way to translate it into code too.
Small recursive function, constantly lowering the amount untill it can fit both the amount and the fee (and then include the dust as fee).

@kewde
Copy link
Author

kewde commented Nov 15, 2016

Okay, so I'm modifying EstimateAnonFee() and creating a new EstimateAnonFeeIncluded() which will do a while loop of EstimateAnonFee, deducting the fee from the amount to spend until it is below max amount.

@kewde
Copy link
Author

kewde commented Nov 15, 2016

I'm currently lowering nMaxAmount in steps of TX_MIN_ANON_FEE, which is the lowest barrier to spend something which seems like a foolproof step to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants