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

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke 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 Mf1902-rpcMining branch from fa73310 to fabf7eb Feb 11, 2019
@benthecarman
Copy link
Contributor

@benthecarman benthecarman commented Feb 11, 2019

This should probably have release notes

@MarcoFalke
Copy link
Member Author

@MarcoFalke MarcoFalke commented Feb 11, 2019

I am happy to write them after this is merged

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

@promag promag commented Feb 11, 2019

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

@practicalswift
Copy link
Contributor

@practicalswift practicalswift 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 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
Copy link
Member Author

@MarcoFalke MarcoFalke commented Feb 11, 2019

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

@MarcoFalke MarcoFalke force-pushed the Mf1902-rpcMining branch from fa60505 to fa7b9c1 Feb 11, 2019
@promag
Copy link
Member

@promag promag commented Feb 11, 2019

@MarcoFalke could test null values now?

@MarcoFalke MarcoFalke force-pushed the Mf1902-rpcMining branch from fa7b9c1 to fa3c0da Feb 11, 2019
src/rpc/mining.cpp Outdated Show resolved Hide resolved
@bitcoin bitcoin deleted a comment from MarcoFalke Feb 11, 2019
@luke-jr
Copy link
Member

@luke-jr luke-jr commented Feb 12, 2019

Why not omit the fields entirely?

@gmaxwell
Copy link
Contributor

@gmaxwell gmaxwell 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.

Copy link
Member

@promag promag 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.

doc/release-notes.md Outdated Show resolved Hide resolved
@MarcoFalke MarcoFalke force-pushed the 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
Copy link
Member Author

@MarcoFalke MarcoFalke commented Feb 12, 2019

Made it to omit the key-value altogether

@promag
Copy link
Member

@promag promag commented Feb 12, 2019

utACK fa178a6.

@MarcoFalke MarcoFalke added this to the 0.18.0 milestone Feb 12, 2019
@laanwj
Copy link
Member

@laanwj laanwj commented Feb 12, 2019

Concept ACK

MarcoFalke added a commit to MarcoFalke/bitcoin-core that referenced this issue Feb 15, 2019
…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
@MarcoFalke MarcoFalke deleted the Mf1902-rpcMining branch Feb 15, 2019
deadalnix added a commit to Bitcoin-ABC/bitcoin-abc that referenced this issue May 4, 2020
Summary:
This is a backport of Core [[bitcoin/bitcoin#15383 | PR15383]]

Obviously currentblockweight => currentblocksize for us.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D5945
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

8 participants