Add getVoteAccounts RPC method parameter to restrict results to a single vote account (#16859)

(cherry picked from commit 59fc33635a)

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2021-04-27 05:43:44 +00:00
committed by GitHub
parent eabc21c23a
commit 7aec87c086
4 changed files with 124 additions and 25 deletions

View File

@@ -2893,11 +2893,14 @@ Returns the account info and associated stake for all the voting accounts in the
#### Parameters:
- `<object>` - (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment)
- `<object>` - (optional) Configuration object containing the following field:
- (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment)
- (optional) `votePubkey: <string>` - Only return results for this validator vote address (base-58 encoded)
#### Results:
The result field will be a JSON object of `current` and `delinquent` accounts, each containing an array of JSON objects with the following sub fields:
The result field will be a JSON object of `current` and `delinquent` accounts,
each containing an array of JSON objects with the following sub fields:
- `votePubkey: <string>` - Vote account address, as base-58 encoded string
- `nodePubkey: <string>` - Validator identity, as base-58 encoded string
@@ -2950,6 +2953,49 @@ Result:
}
```
#### Example: Restrict results to a single validator vote account
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getVoteAccounts",
"params": [
{
"votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw"
}
]
}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"current": [
{
"commission": 0,
"epochVoteAccount": true,
"epochCredits": [
[ 1, 64, 0 ],
[ 2, 192, 64 ]
],
"nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD",
"lastVote": 147,
"activatedStake": 42,
"votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw"
}
],
"delinquent": []
},
"id": 1
}
```
### minimumLedgerSlot
Returns the lowest slot that the node has information about in its ledger. This