Add wallet get-slot command and document how to use it (#5424)
* Add wallet get-slot command and document how to use it * ,
This commit is contained in:
parent
b5aa03dd7c
commit
c7710fdd24
|
@ -238,6 +238,26 @@ The vote pubkey for the validator can also be found by running:
|
||||||
$ solana-keygen pubkey ~/validator-vote-keypair.json
|
$ solana-keygen pubkey ~/validator-vote-keypair.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Has my validator caught up?
|
||||||
|
After your validator boots, it may take some time to catch up with the cluster.
|
||||||
|
Use the `get-slot` wallet command to view the current slot that the cluster is
|
||||||
|
processing:
|
||||||
|
```bash
|
||||||
|
$ solana-wallet get-slot
|
||||||
|
```
|
||||||
|
|
||||||
|
The current slot that your validator is processing can then been seen with:
|
||||||
|
```bash
|
||||||
|
$ solana-wallet --url http://127.0.0.1:8899 get-slot
|
||||||
|
```
|
||||||
|
|
||||||
|
Until your validator has caught up, it will not be able to vote successfully and
|
||||||
|
stake cannot be delegated to it.
|
||||||
|
|
||||||
|
Also if you find the cluster's slot advancing faster than yours, you will likely
|
||||||
|
never catch up. This typically implies some kind of networking issue between
|
||||||
|
your validator and the rest of the cluster.
|
||||||
|
|
||||||
#### Validator Metrics
|
#### Validator Metrics
|
||||||
Metrics are available for local monitoring of your validator.
|
Metrics are available for local monitoring of your validator.
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ pub enum WalletCommand {
|
||||||
ClaimStorageReward(Pubkey, Pubkey),
|
ClaimStorageReward(Pubkey, Pubkey),
|
||||||
ShowStorageAccount(Pubkey),
|
ShowStorageAccount(Pubkey),
|
||||||
Deploy(String),
|
Deploy(String),
|
||||||
|
GetSlot,
|
||||||
GetTransactionCount,
|
GetTransactionCount,
|
||||||
// Pay(lamports, to, timestamp, timestamp_pubkey, witness(es), cancelable)
|
// Pay(lamports, to, timestamp, timestamp_pubkey, witness(es), cancelable)
|
||||||
Pay(
|
Pay(
|
||||||
|
@ -303,6 +304,7 @@ pub fn parse_command(
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)),
|
)),
|
||||||
|
("get-slot", Some(_matches)) => Ok(WalletCommand::GetSlot),
|
||||||
("get-transaction-count", Some(_matches)) => Ok(WalletCommand::GetTransactionCount),
|
("get-transaction-count", Some(_matches)) => Ok(WalletCommand::GetTransactionCount),
|
||||||
("pay", Some(pay_matches)) => {
|
("pay", Some(pay_matches)) => {
|
||||||
let lamports = pay_matches.value_of("lamports").unwrap().parse()?;
|
let lamports = pay_matches.value_of("lamports").unwrap().parse()?;
|
||||||
|
@ -982,6 +984,11 @@ fn process_cancel(rpc_client: &RpcClient, config: &WalletConfig, pubkey: &Pubkey
|
||||||
Ok(signature_str.to_string())
|
Ok(signature_str.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn process_get_slot(rpc_client: &RpcClient) -> ProcessResult {
|
||||||
|
let slot = rpc_client.get_slot()?;
|
||||||
|
Ok(slot.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
fn process_get_transaction_count(rpc_client: &RpcClient) -> ProcessResult {
|
fn process_get_transaction_count(rpc_client: &RpcClient) -> ProcessResult {
|
||||||
let transaction_count = rpc_client.get_transaction_count()?;
|
let transaction_count = rpc_client.get_transaction_count()?;
|
||||||
Ok(transaction_count.to_string())
|
Ok(transaction_count.to_string())
|
||||||
|
@ -1182,6 +1189,7 @@ pub fn process_command(config: &WalletConfig) -> ProcessResult {
|
||||||
process_deploy(&rpc_client, config, program_location)
|
process_deploy(&rpc_client, config, program_location)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WalletCommand::GetSlot => process_get_slot(&rpc_client),
|
||||||
WalletCommand::GetTransactionCount => process_get_transaction_count(&rpc_client),
|
WalletCommand::GetTransactionCount => process_get_transaction_count(&rpc_client),
|
||||||
|
|
||||||
// If client has positive balance, pay lamports to another address
|
// If client has positive balance, pay lamports to another address
|
||||||
|
@ -1678,6 +1686,10 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||||
.help("/path/to/program.o"),
|
.help("/path/to/program.o"),
|
||||||
), // TODO: Add "loader" argument; current default is bpf_loader
|
), // TODO: Add "loader" argument; current default is bpf_loader
|
||||||
)
|
)
|
||||||
|
.subcommand(
|
||||||
|
SubCommand::with_name("get-slot")
|
||||||
|
.about("Get current slot"),
|
||||||
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("get-transaction-count")
|
SubCommand::with_name("get-transaction-count")
|
||||||
.about("Get current transaction count"),
|
.about("Get current transaction count"),
|
||||||
|
@ -2163,6 +2175,9 @@ mod tests {
|
||||||
let signature = process_command(&config);
|
let signature = process_command(&config);
|
||||||
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
|
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
|
||||||
|
|
||||||
|
config.command = WalletCommand::GetSlot;
|
||||||
|
assert_eq!(process_command(&config).unwrap(), "0");
|
||||||
|
|
||||||
config.command = WalletCommand::GetTransactionCount;
|
config.command = WalletCommand::GetTransactionCount;
|
||||||
assert_eq!(process_command(&config).unwrap(), "1234");
|
assert_eq!(process_command(&config).unwrap(), "1234");
|
||||||
|
|
||||||
|
@ -2270,6 +2285,9 @@ mod tests {
|
||||||
config.command = WalletCommand::AuthorizeVoter(bob_pubkey, Keypair::new(), bob_pubkey);
|
config.command = WalletCommand::AuthorizeVoter(bob_pubkey, Keypair::new(), bob_pubkey);
|
||||||
assert!(process_command(&config).is_err());
|
assert!(process_command(&config).is_err());
|
||||||
|
|
||||||
|
config.command = WalletCommand::GetSlot;
|
||||||
|
assert!(process_command(&config).is_err());
|
||||||
|
|
||||||
config.command = WalletCommand::GetTransactionCount;
|
config.command = WalletCommand::GetTransactionCount;
|
||||||
assert!(process_command(&config).is_err());
|
assert!(process_command(&config).is_err());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue