docs: rpclient is now part of main dcrd repo, fix code examples#970
docs: rpclient is now part of main dcrd repo, fix code examples#970davecgh merged 2 commits intodecred:masterfrom
Conversation
davecgh
left a comment
There was a problem hiding this comment.
Thanks for the PR. It looks good overall, but I have a few recommendations inline.
docs/json_rpc_api.md
Outdated
|
|
||
| ```bash | ||
| Block count: 276978 | ||
| 2018/01/13 16:48:33 Block count: 203528 |
There was a problem hiding this comment.
I would prefer that the timestamp be left off. I'm aware that the log package adds one automatically, but it is going to constantly be out of date anyways, and it clutters up the example output in my opinion.
There was a problem hiding this comment.
OK, makes sense.
docs/json_rpc_api.md
Outdated
| log.Printf("Block connected: %v (%d)", hash, height) | ||
| ntfnHandlers := rpcclient.NotificationHandlers{ | ||
| OnBlockConnected: func(blockHeader []byte, transactions [][]byte) { | ||
| log.Printf("Block connected: %v %v", blockHeader, transactions) |
There was a problem hiding this comment.
Would you mind changing these to %x and updating the sample output accordingly? This is leftover from when they used hashes instead of the actual data.
There was a problem hiding this comment.
Sure, makes sense.
docs/json_rpc_api.md
Outdated
| OnBlockDisconnected: func(hash *wire.ShaHash, height int32) { | ||
| log.Printf("Block disconnected: %v", hash, height) | ||
| OnBlockDisconnected: func(blockHeader []byte) { | ||
| log.Printf("Block disconnected: %v", blockHeader) |
docs/json_rpc_api.md
Outdated
| 2014/05/12 20:33:19 Block connected: 000000000000000007dff1f95f7b3f5eac2892a4123069517caf34e2c417650d (300461) | ||
| 2014/05/12 20:33:27 Client shutting down... | ||
| 2014/05/12 20:31:27 Client shutdown complete. | ||
| 2018/01/13 16:14:30 Client shutdown in 10 seconds... |
There was a problem hiding this comment.
For consistency, if you decide to remove the timestamps from the others, please remove them from these as well.
docs/json_rpc_api.md
Outdated
| Difficulty: 1.000000 | ||
| Size (in bytes): 285 | ||
| Num transactions: 1 | ||
| 2018/01/13 16:46:17 Hash: 298e5cc3d985bfe7f81dc135f360abe089edd4396b86d2de66b0cef42b21d980 |
There was a problem hiding this comment.
For consistency, if you decide to remove the timestamps from the others, please remove them from these as well.
Adjust links and example code to reflect that. Also update example output.
- wire.NewShaHashFromStr has been moved to chainhash.NewHashFromStr - use mainnet port and genesis block hash
|
Thanks for the feedback, I addressed your remarks. |
wire.NewShaHashFromStrhas been moved tochainhash.NewHashFromStrThe prototype of the notification handlers
OnBlockConnectedandOnBlockDisconnectedchanged.Any ideas how to process the
blockHeaderbyte slice to make the output more meaningful?