Skip to content

Commit

Permalink
Default unknown methods to 'never' cache (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiranjanaBinoy authored Dec 15, 2020
1 parent 76d6765 commit 250eda0
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions src/cache-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ function blockTagParamIndex (payload) {
}
}

// eslint-disable-next-line consistent-return
function cacheTypeForPayload (payload) {
// eslint-disable-next-line default-case
switch (payload.method) {
// cache permanently
case 'web3_clientVersion':
Expand Down Expand Up @@ -116,39 +114,7 @@ function cacheTypeForPayload (payload) {
return 'block'

// never cache
case 'net_version':
case 'net_peerCount':
case 'net_listening':
case 'eth_syncing':
case 'eth_sign':
case 'eth_coinbase':
case 'eth_mining':
case 'eth_hashrate':
case 'eth_accounts':
case 'eth_sendTransaction':
case 'eth_sendRawTransaction':
case 'eth_newFilter':
case 'eth_newBlockFilter':
case 'eth_newPendingTransactionFilter':
case 'eth_uninstallFilter':
case 'eth_getFilterChanges':
case 'eth_getWork':
case 'eth_submitWork':
case 'eth_submitHashrate':
case 'db_putString':
case 'db_getString':
case 'db_putHex':
case 'db_getHex':
case 'shh_post':
case 'shh_newIdentity':
case 'shh_hasIdentity':
case 'shh_newGroup':
case 'shh_addToGroup':
case 'shh_newFilter':
case 'shh_uninstallFilter':
case 'shh_getFilterChanges':
case 'shh_getMessages':
case 'test_neverCache':
default:
return 'never'
}
}

0 comments on commit 250eda0

Please sign in to comment.