-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Fix help, add RPC tests for getblockheader #7194
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
Conversation
Nice. utACK. |
int(string, 16) | ||
except Exception as e: | ||
raise AssertionError( | ||
"Couldn't interpret %r as hexidecimal; raised: %s" % (string, e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hexadecimal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
82088e2
to
3af5edc
Compare
@jonasschnelli good point, thanks. I've changed the PR title to reflect this. |
utACK |
talked with @morcos out-of-band, sounds as though he's cool with changes as they are. |
@@ -323,7 +323,8 @@ UniValue getblockheader(const UniValue& params, bool fHelp) | |||
" \"bits\" : \"1d00ffff\", (string) The bits\n" | |||
" \"difficulty\" : x.xxx, (numeric) The difficulty\n" | |||
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" | |||
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n" | |||
" \"nextblockhash\" : \"hash\", (string) The hash of the next block\n" | |||
" \"chainwork\" : \"0000...1f3\" (string) Number of hashes expected to produce the current chain (in hex)\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about "Expected number of hashes required to produce the current chain"?
Current wording could be read as "do that work, will get the current chain", which is a bit unlikely. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure thing. fixed
utACK modulo wording |
3af5edc
to
442afca
Compare
elif length and len(string) != length: | ||
raise AssertionError( | ||
"String of length %d expected; got %d" % (length, len(string))) | ||
elif not re.match('[abcdef0-9]+', string): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want:
elif not re.match('[abcdef0-9]+$', string):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very true :). willfix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
442afca
to
135d6ec
Compare
@@ -323,7 +323,8 @@ UniValue getblockheader(const UniValue& params, bool fHelp) | |||
" \"bits\" : \"1d00ffff\", (string) The bits\n" | |||
" \"difficulty\" : x.xxx, (numeric) The difficulty\n" | |||
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" | |||
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n" | |||
" \"nextblockhash\" : \"hash\", (string) The hash of the next block\n" | |||
" \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the expected number of hashes up to this point in the chain, not the entire chain. AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a similar line for getblock at #7232
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message is based on @sipa's description of chainwork and was vetted previously by @petertodd. You may want to close the PR you reference above; it was opened after this one and doesn't include tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I disagree that it's clear, but if everyone else is fine with it I can conform as well.
Regardless, my pull is not covered here, so not sure why would I close it?
edit: My title wasn't clear, so I added the specific rpc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@instagibbs thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps my newer suggestion is equitable?
https://github.com/bitcoin/bitcoin/pull/7232/files#r48769375
ping on this |
I'll start reviewing again after new year.
|
utACK |
Continuing to chip away at the untested RPC interface. This PR:
getblockheader
(previously uncovered)getblockheader
RPC help