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

assets: add a DCR backend #17

Merged
merged 14 commits into from
Sep 7, 2019
Merged

assets: add a DCR backend #17

merged 14 commits into from
Sep 7, 2019

Conversation

buck54321
Copy link
Member

Adds a dcrd RPC client backend and a DEX backend interface. Methods for handling transactions, UTXOs, and swap contracts are implemented.

There are offline tests and live tests. Use the -tags=drclive tag to run the live tests. The live tests assume a mainnet node and a pretty default configuration, so may need to tweak things if yours are different.

I'm sure the interface will need more methods. For instance it doesn't have a way to monitor the health of the backend itself. It should probably be clear to the DEX when the backend is not connected to the node or such.

server/asset/dcr/cache.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Show resolved Hide resolved
server/asset/dcr/live_test.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Outdated Show resolved Hide resolved
server/asset/dcr/tx.go Outdated Show resolved Hide resolved
server/asset/dcr/tx.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Outdated Show resolved Hide resolved
server/asset/dcr/tx.go Outdated Show resolved Hide resolved
server/asset/dcr/utxo.go Outdated Show resolved Hide resolved
@buck54321
Copy link
Member Author

I implemented P2SH support, as well as allowing vote and revocation outputs to be spent after maturity.

I also did multi-sig, though only as P2SH. Enabling multi-sig requires a change to the DEX specification to make the pubkey and sig fields of the UTXO object into arrays of strings. As discussed elsewhere, I'll propose the spec changes in a separate PR.

server/asset/dcr/script.go Outdated Show resolved Hide resolved
@buck54321 buck54321 force-pushed the dcr branch 2 times, most recently from b594b3c to cd26107 Compare August 31, 2019 20:31
server/asset/dcr/tx.go Show resolved Hide resolved
server/asset/dcr/utxo.go Show resolved Hide resolved
server/asset/common.go Show resolved Hide resolved
server/asset/common.go Outdated Show resolved Hide resolved
server/asset/dcr/script.go Outdated Show resolved Hide resolved
server/asset/dcr/dcr.go Outdated Show resolved Hide resolved
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.

LGTM. Any more commits to push?

A DCR backend for gathering information about UTXOs and signatures.
Also DEXAsset, a common interface for asset backends, which the DCR
backend implements. Includes both offline and live unit tests.
Adds a DEXTx interface for getting transaction information and using
it to verify swap contracts and spend outputs.
Adds P2SH support and multi-sig. Also adds parsing of stake versions
of supported script types so that vote and revocation outputs can be
used as inputs after maturation.
These changes modify the DCR backend constructor to be the same as
the BTC constructor. The choice of network is based on a DEX supplied
ID, and other configuration settings are loaded from a specified
filepath.
Adds support for Edwards and Schnorr signatures. Modifies the live
utxo test to take more complete statistics.
Also changes UTXO.ScriptSize to UTXO.SpendSize, since the size is
more than just the sig script.
@buck54321
Copy link
Member Author

Should be good now.

@chappjc chappjc merged commit 952d335 into decred:master Sep 7, 2019
@chappjc chappjc mentioned this pull request Sep 9, 2019
4 tasks
@chappjc chappjc added the server server components label Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server server components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants