Skip to content

Commit

Permalink
cmd/utils: exit process if txlookuplimit flag is set (bnb-chain#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed Dec 5, 2023
1 parent 533a220 commit be8e612
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ Note: if you can not download the chaindata snapshot and want to sync from genes
So just run: `geth --datadir <datadir> init ./genesis.json`
#### 4. Start a full node
```shell
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0

## It is recommand to run fullnode with `--tries-verify-mode none` if you want high performance and care little about state consistency
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none
```
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --tries-verify-mode none

#### 5. Monitor node status

Expand Down
6 changes: 2 additions & 4 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1948,14 +1948,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Parse transaction history flag, if user is still using legacy config
// file with 'TxLookupLimit' configured, copy the value to 'TransactionHistory'.
if cfg.TransactionHistory == ethconfig.Defaults.TransactionHistory && cfg.TxLookupLimit != ethconfig.Defaults.TxLookupLimit {
log.Warn("The config option 'TxLookupLimit' is deprecated and will be removed, please use 'TransactionHistory'")
cfg.TransactionHistory = cfg.TxLookupLimit
log.Crit("The config option 'TxLookupLimit' is deprecated and may cause unexpected performance degradation issues, please use 'TransactionHistory' instead")
}
if ctx.IsSet(TransactionHistoryFlag.Name) {
cfg.TransactionHistory = ctx.Uint64(TransactionHistoryFlag.Name)
} else if ctx.IsSet(TxLookupLimitFlag.Name) {
log.Warn("The flag --txlookuplimit is deprecated and will be removed, please use --history.transactions")
cfg.TransactionHistory = ctx.Uint64(TransactionHistoryFlag.Name)
log.Crit("The flag --txlookuplimit is deprecated and may cause unexpected performance degradation issues. Please use --history.transactions instead")
}
if ctx.IsSet(PathDBSyncFlag.Name) {
cfg.PathSyncFlush = true
Expand Down
2 changes: 2 additions & 0 deletions log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package log

import (
"os"
"time"
)

var (
Expand Down Expand Up @@ -105,6 +106,7 @@ func Error(msg string, ctx ...interface{}) {
// log.Crit("msg", "key1", val1, "key2", val2)
func Crit(msg string, ctx ...interface{}) {
root.write(msg, LvlCrit, ctx, skipLevel)
time.Sleep(3 * time.Second)
os.Exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/truffle/scripts/bsc-rpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ done

geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \
--verbosity ${VERBOSE} --nousb \
--rpc.allow-unprotected-txs --txlookuplimit 15768000 \
--rpc.allow-unprotected-txs --history.transactions 15768000 \
-unlock ${unlock_sequences} --password /dev/null
2 changes: 1 addition & 1 deletion tests/truffle/scripts/bsc-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUS
--bootnodes enode://${BOOTSTRAP_PUB_KEY}@${BOOTSTRAP_IP}:${BOOTSTRAP_TCP_PORT} \
--mine -unlock ${VALIDATOR_ADDR} --miner.etherbase ${VALIDATOR_ADDR} --password /dev/null \
--light.serve 50 \
--rpc.allow-unprotected-txs --txlookuplimit 15768000
--rpc.allow-unprotected-txs --history.transactions 15768000

0 comments on commit be8e612

Please sign in to comment.