-
Notifications
You must be signed in to change notification settings - Fork 92
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
multi: switch to coin id #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just some comments that may or may not require changes.
This commit and other changes in this PR change the way fees are evaluated on the server. It was meant to be a couple of small changes as I reworked the DEXAsset interface, but it became a whole thing. In particular, the BTC and clone backends use vsize for fee evaluation instead of byte size, and the DCR backends evaluate the fees as zero for coinbase transactions. The second change does little for us in production, since we don't evaluate fees on funding transactions, but for live testing, it helps to tame some unwanted behavior.
|
||
// Convert the DCR value to atoms. | ||
func toAtoms(v float64) uint64 { | ||
return uint64(math.Round(v * 1e8)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm always squeamish about multiplying in float, but this is what dcrutil.NewAmount does so I suppose it's sufficient for a *1e8.
This completes the switch to coin ID proposed in #75. Coin IDs are used to identify spendable value, and are represented as a variable-length byte array (
[]byte
in Go). Asset backends and wallets have some latitude to choose encoding, though for UTXO-based assets, the encoding<32-byte tx hash>|<4-byte vout>
is recommended.