-
Notifications
You must be signed in to change notification settings - Fork 1
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
Coin allocation #12
Comments
What? Why would a WT want to forget about a vault? Why wouldn't the WT watch a delegated vault until it is consumed with spend/cancel/emer? |
I meant after it's consumed obviously. Editing now to make it clearer |
For posterity: the code doesn't actually implement that, but something reasonably similar. It falls back to selecting any coin instead of failing too. |
So actually the current coin selection falls back to allocate coins out of the distribution instead of failing. I think it should fail as it could allocate too many coins to a vault while the Cancel coin selection algorithm is cc @JSwambo |
We should consider a consumed vault to be spent and forget it after a long enough period, say
144
blocks. A one day reorg would already raise more significant concerns about PoW than we need to worry for our poor coin re-allocation mechanism for fee-bumping wallets.Once a vault is forgotten, if it still had coins allocated to it (ie if it was spent cleanly, or Canceled without needing to use the entire reserve [0]) they are marked as "unregistered".
Freshly refilled coins are laid-out as described in #5 and marked as "unregistered".
When we are asked to watch a new vault (currently at vault creation but should probably be at vault delegation instead), we pick one "Vm coin" and
n
"Vb coin"s (see #5 for the definition ofVm
andVb
and some discussion around it) from the pool of "unregistered" coins. We follow this process:v
is closer toVm
with a maximum gap of0.2 * Vm
, this is the "Vm coin". If no such coin exist, fail (FIXME: we should instead consolidate? Or actually just multiple haveVm
coins?).5
and smaller than10
of coins from the pool which total valuet
is(R*S - Vm)*0.95 <= t <= (R*S - Vm)*1.05
[1], these are then
"Vb coin"s. If no such set exist, fail (FIXME: dig more into the margins and bounds there)[0] Note how this is likely given the very high value of the reserve.
[1] This is in order to be able to work with coins which value is not exactly close to
Vb
without having to consolidate them. In practice however the "Vb coins"s are expected to be somewhat consistent in size over a medium timeframe.The text was updated successfully, but these errors were encountered: