require premium for debug module
This commit is contained in:
parent
cef4edc17a
commit
45fb2e5ea6
@ -1633,6 +1633,16 @@ impl App {
|
|||||||
method
|
method
|
||||||
)).into());
|
)).into());
|
||||||
}
|
}
|
||||||
|
if method.starts_with("debug_") {
|
||||||
|
// make sure its premium
|
||||||
|
if !(self.config.free_subscriptions
|
||||||
|
|| web3_request.authorization.active_premium().await)
|
||||||
|
{
|
||||||
|
return Err(Web3ProxyError::AccessDenied(
|
||||||
|
"debug methods require an active premium account".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if web3_request.cache_mode.is_some() {
|
if web3_request.cache_mode.is_some() {
|
||||||
// don't cache anything larger than 16 MiB
|
// don't cache anything larger than 16 MiB
|
||||||
|
@ -469,6 +469,7 @@ impl CacheMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn cache_jsonrpc_errors(&self) -> bool {
|
pub fn cache_jsonrpc_errors(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::Never => false,
|
Self::Never => false,
|
||||||
@ -478,6 +479,7 @@ impl CacheMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn from_block(&self) -> Option<&BlockNumAndHash> {
|
pub fn from_block(&self) -> Option<&BlockNumAndHash> {
|
||||||
match self {
|
match self {
|
||||||
Self::SuccessForever => None,
|
Self::SuccessForever => None,
|
||||||
@ -492,6 +494,7 @@ impl CacheMode {
|
|||||||
!matches!(self, Self::Never)
|
!matches!(self, Self::Never)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn to_block(&self) -> Option<&BlockNumAndHash> {
|
pub fn to_block(&self) -> Option<&BlockNumAndHash> {
|
||||||
match self {
|
match self {
|
||||||
Self::SuccessForever => None,
|
Self::SuccessForever => None,
|
||||||
|
@ -501,6 +501,7 @@ impl ValidatedRequest {
|
|||||||
self.cache_mode.to_block().map(|x| *x.num())
|
self.cache_mode.to_block().map(|x| *x.num())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn min_block_needed(&self) -> Option<U64> {
|
pub fn min_block_needed(&self) -> Option<U64> {
|
||||||
if self.archive_request.load(atomic::Ordering::Relaxed) {
|
if self.archive_request.load(atomic::Ordering::Relaxed) {
|
||||||
Some(U64::zero())
|
Some(U64::zero())
|
||||||
|
Loading…
Reference in New Issue
Block a user