Author

Topic: Adding more details to JSON-RPC method output (Read 1070 times)

hero member
Activity: 481
Merit: 529
October 30, 2011, 11:12:18 PM
#5
This shouldn't add any overhead
Oh, the runtime CPU and memory cost would be tiny, I'm sure.  But now, as a code reader, I must scan past three new globals to see the meatier parts such as pindexBest right above them.  It's not that I don't like the feature, or even (maybe) enabling it by default, but adding things in this way gradually makes the program harder to understand.

I'm assuming mere integer read/set doesn't need a mutex to be safe-- you either see the value before or after the change.
Even for uint64 on 32-bit systems?  And what if parts of the same getinfo result reflect changes that other parts don't reflect?
legendary
Activity: 2576
Merit: 1186
This shouldn't add any overhead, and I'm assuming mere integer read/set doesn't need a mutex to be safe-- you either see the value before or after the change.
hero member
Activity: 481
Merit: 529
Luke-Jr, thanks for the patch.

Assuming it is bug free (which I'm not sure... does it mutex the reads of shared data like nPooledTx?) my concern is code bloat for a feature with a dozen(?) potential users.  Not to say the code base isn't currently bloated, Grin but now seems a good time to mention refactoring options.

Imagine compile-time options similar to -DUSE_UPNP and -DGUI controlling inclusion of esoteric features.  (I note that optional features should in no way affect the validation rules, since we want everyone to agree on those.)  Luke's features, and probably over half the existing RPC cruft, could go in a separate file, ideally behind a module interface such as VinceD's hooks.  Imagine "extensions.cpp" defining CExtension extensions[], each element's existence controlled by an #ifdef, and each CExtension implementing a bunch of hooks, one of which the RPC table constructor would call and allow to insert methods.

Anyone?
legendary
Activity: 2576
Merit: 1186
Bump.
legendary
Activity: 2576
Merit: 1186
Link to pull request

These changes are 100% backward compatible.

Adds to "getinfo" output: "pooledtx" (number of transactions in memory pool), "currentblocktx" (number of txns in the last block created), and "currentblocksize"

Adds to "listtransactions" and similar output: "block_hash" and "block_index"
Jump to: