rpc: turn off getStakeActivation epoch parameter (#33156)
* Return error on past-epoch parameter * Update docs
This commit is contained in:
parent
05622c17da
commit
17b1b5646d
|
@ -41,6 +41,7 @@ Configuration object containing the following fields:
|
||||||
<Field name="epoch" type="u64" optional={true}>
|
<Field name="epoch" type="u64" optional={true}>
|
||||||
epoch for which to calculate activation details. If parameter not provided,
|
epoch for which to calculate activation details. If parameter not provided,
|
||||||
defaults to current epoch.
|
defaults to current epoch.
|
||||||
|
**DEPRECATED**, inputs other than the current epoch return an error.
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
</Parameter>
|
</Parameter>
|
||||||
|
|
|
@ -1719,14 +1719,10 @@ impl JsonRpcRequestProcessor {
|
||||||
min_context_slot: config.min_context_slot,
|
min_context_slot: config.min_context_slot,
|
||||||
})?;
|
})?;
|
||||||
let epoch = config.epoch.unwrap_or_else(|| bank.epoch());
|
let epoch = config.epoch.unwrap_or_else(|| bank.epoch());
|
||||||
if bank.epoch().saturating_sub(epoch) > solana_sdk::stake_history::MAX_ENTRIES as u64 {
|
if epoch != bank.epoch() {
|
||||||
return Err(Error::invalid_params(format!(
|
return Err(Error::invalid_params(format!(
|
||||||
"Invalid param: epoch {epoch:?} is too far in the past"
|
"Invalid param: epoch {epoch:?}. Only the current epoch ({:?}) is supported",
|
||||||
)));
|
bank.epoch()
|
||||||
}
|
|
||||||
if epoch > bank.epoch() {
|
|
||||||
return Err(Error::invalid_params(format!(
|
|
||||||
"Invalid param: epoch {epoch:?} has not yet started"
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue