Add getBlockConfidence rpc endpoint (#6350)

automerge
This commit is contained in:
Tyera Eulberg
2019-10-14 16:24:10 -06:00
committed by Grimes
parent c2ebf466fd
commit 5d99853502
5 changed files with 303 additions and 79 deletions

View File

@@ -17,6 +17,7 @@ To interact with a Solana node inside a JavaScript application, use the [solana-
* [confirmTransaction](jsonrpc-api.md#confirmtransaction)
* [getAccountInfo](jsonrpc-api.md#getaccountinfo)
* [getBalance](jsonrpc-api.md#getbalance)
* [getBlockConfidence](jsonrpc-api.md#getblockconfidence)
* [getClusterNodes](jsonrpc-api.md#getclusternodes)
* [getEpochInfo](jsonrpc-api.md#getepochinfo)
* [getGenesisBlockhash](jsonrpc-api.md#getgenesisblockhash)
@@ -149,6 +150,34 @@ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "
{"jsonrpc":"2.0","result":0,"id":1}
```
### getBlockConfidence
Returns confidence for particular block
#### Parameters:
* `u64` - block, identified by Slot
#### Results:
The result field will be an array with two fields:
* Confidence
* `null` - Unknown block
* `object` - BankConfidence
* `array` - confidence, array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY`
* 'integer' - total active stake, in lamports, of the current epoch
#### Example:
```bash
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getBlockConfidence","params":[5]}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":[{"confidence":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,32]},42],"id":1}
```
### getClusterNodes
Returns information about all the nodes participating in the cluster
@@ -808,4 +837,3 @@ Unsubscribe from signature confirmation notification
// Result
{"jsonrpc": "2.0","result": true,"id": 1}
```