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

[rpc] mining: Omit uninitialized currentblockweight, currentblocktx #15383

Merged
merged 1 commit into from Feb 15, 2019

Conversation

Projects
None yet
8 participants
@MarcoFalke
Copy link
Member

commented Feb 11, 2019

Previously we'd report "0", which could be mistaken for a valid number. E.g. the number of transactions is 0 or the block weight is 0, whatever that means.

@MarcoFalke MarcoFalke changed the title [rpc] mining: Report -1 for uninitialized currentblockweight and currentblocktx [rpc] mining: Report -1 for uninitialized currentblockweight, currentblocktx Feb 11, 2019

@MarcoFalke MarcoFalke force-pushed the MarcoFalke:Mf1902-rpcMining branch from fa73310 to fabf7eb Feb 11, 2019

@benthecarman

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

This should probably have release notes

@MarcoFalke

This comment has been minimized.

Copy link
Member Author

commented Feb 11, 2019

I am happy to write them after this is merged

Show resolved Hide resolved src/rpc/mining.cpp Outdated
@promag

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

Concept ACK, change looks good too. Could have a test for -1 values?

@practicalswift

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

Looks good but nLastBlockTx and nLastBlockWeight should be removed from miner.cpp too?

$ git grep -E 'nLastBlockTx|nLastBlockWeight'
src/miner.cpp:uint64_t nLastBlockTx = 0;
src/miner.cpp:uint64_t nLastBlockWeight = 0;

@MarcoFalke MarcoFalke force-pushed the MarcoFalke:Mf1902-rpcMining branch from fabf7eb to fa60505 Feb 11, 2019

@MarcoFalke MarcoFalke changed the title [rpc] mining: Report -1 for uninitialized currentblockweight, currentblocktx [rpc] mining: Report null for uninitialized currentblockweight, currentblocktx Feb 11, 2019

@MarcoFalke

This comment has been minimized.

Copy link
Member Author

commented Feb 11, 2019

Added release notes, removed leftover variables, run clang format, ... Should be ready

@MarcoFalke MarcoFalke force-pushed the MarcoFalke:Mf1902-rpcMining branch from fa60505 to fa7b9c1 Feb 11, 2019

@promag

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

@MarcoFalke could test null values now?

@MarcoFalke MarcoFalke force-pushed the MarcoFalke:Mf1902-rpcMining branch from fa7b9c1 to fa3c0da Feb 11, 2019

Show resolved Hide resolved src/rpc/mining.cpp Outdated

@bitcoin bitcoin deleted a comment from MarcoFalke Feb 11, 2019

@luke-jr

This comment has been minimized.

Copy link
Member

commented Feb 12, 2019

Why not omit the fields entirely?

@gmaxwell

This comment has been minimized.

Copy link
Member

commented Feb 12, 2019

Omitting the fields was also my intuition (just going off the first line of the PR description). It's true that some software might not handle omitted fields well, but the same stuff would probably not handle the special json null either.

@promag
Copy link
Member

left a comment

@luke-jr @gmaxwell it was suggested before #15383 (comment). Since it's an edge case, once set it's always present, I tend to prefer null value.

utACK fa3c0da.

Show resolved Hide resolved doc/release-notes.md Outdated

@MarcoFalke MarcoFalke force-pushed the MarcoFalke:Mf1902-rpcMining branch from fa3c0da to fa178a6 Feb 12, 2019

@MarcoFalke MarcoFalke changed the title [rpc] mining: Report null for uninitialized currentblockweight, currentblocktx [rpc] mining: Omit uninitialized currentblockweight, currentblocktx Feb 12, 2019

@MarcoFalke

This comment has been minimized.

Copy link
Member Author

commented Feb 12, 2019

Made it to omit the key-value altogether

@promag

This comment has been minimized.

Copy link
Member

commented Feb 12, 2019

utACK fa178a6.

@MarcoFalke MarcoFalke added this to the 0.18.0 milestone Feb 12, 2019

@laanwj

This comment has been minimized.

Copy link
Member

commented Feb 12, 2019

Concept ACK

MarcoFalke added a commit to MarcoFalke/bitcoin that referenced this pull request Feb 15, 2019

Merge bitcoin#15383: [rpc] mining: Omit uninitialized currentblockwei…
…ght, currentblocktx

fa178a6 [rpc] mining: Omit uninitialized currentblockweight, currentblocktx (MarcoFalke)

Pull request description:

  Previously we'd report "0", which could be mistaken for a valid number. E.g. the number of transactions is 0 or the block weight is 0, whatever that means.

Tree-SHA512: ee94ab203a329e272211b726f4c23edec4b09c650ec363b77fd59ad9264165d73064f78ebb9e11b5c2c543b73c157752410a307655560531c7d5444d203aa0ea

@MarcoFalke MarcoFalke merged commit fa178a6 into bitcoin:master Feb 15, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@MarcoFalke MarcoFalke deleted the MarcoFalke:Mf1902-rpcMining branch Feb 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.