Add getVoteAccounts RPC method parameter to restrict results to a single vote account

This commit is contained in:
Michael Vines
2021-04-26 18:27:35 -07:00
committed by mergify[bot]
parent b66a68975b
commit 59fc33635a
4 changed files with 124 additions and 25 deletions

View File

@ -2848,11 +2848,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
@ -2905,6 +2908,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