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

Add fetch-block query (resolves #375) #492

Merged
merged 2 commits into from
Oct 5, 2018

Conversation

thecodefactory
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented Oct 2, 2018

Coverage Status

Coverage remained the same at ?% when pulling 7c18b5c on thecodefactory:fetch-block into 3303abc on libbitcoin:master.

auto deserial = make_safe_deserializer(data.begin(), data.end());
const auto block_hash = deserial.read_hash();

node.chain().fetch_block(block_hash, node.blockchain_settings().bip141,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evoskuil Is this a sane way to pass the witness bool?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the better way to go, rather than checking the config setting directly:

    const auto witness = script::is_enabled(
        node.blockchain_settings().enabled_forks(), rule_fork::bip141_rule);

    node.chain().fetch_block(block_hash, witness,
        std::bind(&blockchain::block_fetched,
            _1, _2, request, handler));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting here that since it's a new API for v4, we could just hardcode true for this parameter, similar to fetch_transaction2. Alternatively, I could update fetch_transaction2 to use this style so that if the node isn't configured for it, it won't use it (similar to fetch_transaction, but configurable).

I'll probably opt for the latter and we can re-visit and re-organize as needed.

@thecodefactory thecodefactory merged commit 7f8beaa into libbitcoin:master Oct 5, 2018
@thecodefactory thecodefactory deleted the fetch-block branch December 30, 2018 15:50
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

2 participants