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

multi: switch to coin id #91

Merged
merged 2 commits into from
Dec 3, 2019
Merged

multi: switch to coin id #91

merged 2 commits into from
Dec 3, 2019

Conversation

buck54321
Copy link
Member

@buck54321 buck54321 commented Nov 27, 2019

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.

Copy link
Member

@chappjc chappjc left a 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.

server/asset/btc/btc.go Show resolved Hide resolved
server/asset/btc/testing.go Show resolved Hide resolved
server/asset/dcr/dcr.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Show resolved Hide resolved
server/db/driver/pg/orders.go Show resolved Hide resolved
server/db/driver/pg/orders.go Show resolved Hide resolved
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.
@buck54321 buck54321 marked this pull request as ready for review December 3, 2019 13:09

// Convert the DCR value to atoms.
func toAtoms(v float64) uint64 {
return uint64(math.Round(v * 1e8))
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 always squeamish about multiplying in float, but this is what dcrutil.NewAmount does so I suppose it's sufficient for a *1e8.

@chappjc chappjc merged commit b64658e into decred:master Dec 3, 2019
@buck54321 buck54321 mentioned this pull request Dec 3, 2019
2 tasks
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