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

backend: allow using offline node #14

Merged
merged 3 commits into from Dec 1, 2020
Merged

Conversation

matheusd
Copy link
Member

This makes it possible to run an offline dcrros node. This is needed in order to fully fulfill the specs for the Construction API, where certain operations are only performed in offline instances (that is, instances not connected to the larger underlying blockchain network).

A set of tests based on dcrd's rpctest package are added to ensure conformance to the requirements for offline nodes when used in a Construction API workflow as proposed by the Rosetta specs.

This fixes a bug that created transactions with tx version 0 if the
metadata for tx version was unspecified. This could prevent transactions
generated by the Construction API from being mined and relayed.

We fix this by ensuring transactions generated by RosettaOpsToTx are
initialized by the standard wire.NewMsgTx() function.

Additionally, we switch some errors to variables for better
identification and add tests to assert edge cases of the RosettaOpsToTx
function.
This modifies the Server service to allow it connecting to a backing
dcrd node that does not have any blockchain data. Such nodes are usually
offline nodes, that are not connected to the larger network and are used
only for the offline Construction API operations.

This is implemented by waiting for peers for up to 10 seconds after the
server is initialized. If no peers are found, initialization proceeds
potentially skipping any blockchain sync or account preprocessing.
This adds tests for the Data and Construction APIs using dcrd's rpctest
framework. This offers greater assurance that the overall integration
between dcrros and dcrd nodes are working as expected.

The Github Actions CI workflow has been updated to checkout and install
the latest stable dcrd version in order for the tests to run in that CI.
@matheusd matheusd merged commit 85ee1c0 into decred:master Dec 1, 2020
@matheusd matheusd deleted the offline-node branch December 1, 2020 13:54
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.

None yet

1 participant