Skip to content

Commit

Permalink
fix: set the max gas to 10m on tx_pool test to match what is on geth
Browse files Browse the repository at this point in the history
refactor: tidy up the code that checks the message type when using raft
  • Loading branch information
ricardolyn committed Jan 15, 2021
1 parent 0392695 commit c8d63d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion core/tx_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func setupTxPool() (*TxPool, *ecdsa.PrivateKey) {

func setupTxPoolWithConfig(config *params.ChainConfig) (*TxPool, *ecdsa.PrivateKey) {
statedb, _ := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()))
// TODO ricardolyn: investigate why 1m is not enough for gasLimit. changed to 10m for now
blockchain := &testBlockChain{statedb, statedb, 10000000, new(event.Feed)}

key, _ := crypto.GenerateKey()
Expand Down
15 changes: 7 additions & 8 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,14 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {

// Quorum
if pm.raftMode {
// TODO ricardolyn: refactor to reduce duplication of msg.Code
if msg.Code != TransactionMsg && msg.Code != PooledTransactionsMsg &&
msg.Code != GetPooledTransactionsMsg && msg.Code != NewPooledTransactionHashesMsg &&
msg.Code != GetBlockHeadersMsg && msg.Code != BlockHeadersMsg &&
msg.Code != GetBlockBodiesMsg && msg.Code != BlockBodiesMsg {

// Error coming from here
switch msg.Code {
case TransactionMsg, PooledTransactionsMsg,
GetPooledTransactionsMsg, NewPooledTransactionHashesMsg,
GetBlockHeadersMsg, BlockHeadersMsg,
GetBlockBodiesMsg, BlockBodiesMsg:
// supported by Raft
default:
log.Info("raft: ignoring message", "code", msg.Code)

return nil
}
} else if handler, ok := pm.engine.(consensus.Handler); ok {
Expand Down

0 comments on commit c8d63d1

Please sign in to comment.