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 getblockheader RPC call #6247

Merged
merged 1 commit into from Jul 2, 2015
Merged

Conversation

@petertodd
Copy link
Contributor

@petertodd petertodd commented Jun 7, 2015

Alternative to getblock that works even when the block itself has been pruned, returning all available information. Right now the fact that you can't get this information in pruned mode makes pruned nodes quite a bit less useful for some applications.

Alternative to getblock that works even when the block itself has been
pruned, returning all available information.
@laanwj
Copy link
Member

@laanwj laanwj commented Jun 7, 2015

Not against this, but you can get already get block headers using REST /rest/headers/<count>/<hash>.<ext>.

@jonasschnelli
Copy link
Member

@jonasschnelli jonasschnelli commented Jun 7, 2015

Also not against this, but i think public blockchain data like blocks (headers), transactions or UTXO queries should go over REST instead over an authenticated RPC call. This would follow a more logical design.

Nevertheless, this can be useful because we never merge JSON support for REST Headers (https://github.com/bitcoin/bitcoin/pull/5486/files).

What about getting more in line with REST and also support requesting more than one header (/rest/headers/***<count>***/<hash>.<ext>.)?

@jgarzik
Copy link
Contributor

@jgarzik jgarzik commented Jun 7, 2015

That's the general goal of REST - querying public, unauthenticated blockchain data from the blockchain engine. Seems better placed there, than RPC.

@paveljanik
Copy link
Contributor

@paveljanik paveljanik commented Jun 8, 2015

This allows you to get the needed information directly from the Debug window/Console without the needed hackery around the -rest cmdline etc. Very useful! Thanks Peter.

utACK

@laanwj laanwj added the RPC/REST/ZMQ label Jun 9, 2015
@@ -51,6 +51,32 @@ double GetDifficulty(const CBlockIndex* blockindex)
return dDiff;
}

UniValue blockheaderToJSON(const CBlockIndex* blockindex)

This comment has been minimized.

@laanwj

laanwj Jun 12, 2015
Member

There's a strong overlap with #5486 here - even the function is called the same. This does expose a few more values, also derived ones like confirmation and chainwork.

@laanwj
Copy link
Member

@laanwj laanwj commented Jun 30, 2015

Tested ACK

@petertodd
Copy link
Contributor Author

@petertodd petertodd commented Jun 30, 2015

@jgarzik Re: "unauthenticated" data, remember that this is trusted data in the sense that the client would be trusting the full node's opinion on what the valid chain is; I'm not sure I'd use the term "unauthenticated" in describing that, rather, public and trusted.

@laanwj laanwj merged commit 076badb into bitcoin:master Jul 2, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
laanwj added a commit that referenced this pull request Jul 2, 2015
076badb Add getblockheader RPC call (Peter Todd)
@dcousens
Copy link
Contributor

@dcousens dcousens commented Dec 4, 2015

Needs to be updated in the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants