Skip to content

Commit

Permalink
Merge pull request #310 from cheng762/feature/compatible-with-graphql
Browse files Browse the repository at this point in the history
fix  p2p chainid not set
  • Loading branch information
benbaley committed Jan 26, 2022
2 parents 7fb9d1a + a592304 commit 3cc9c75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func New(stack *node.Node, config *Config) (*Ethereum, error) {
}

log.Info("Initialised chain configuration", "config", chainConfig)
stack.ChainID = chainConfig.ChainID
stack.SetP2pChainID(chainConfig.ChainID)

eth := &Ethereum{
config: config,
Expand Down
5 changes: 3 additions & 2 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ type Node struct {

databases map[*closeTrackingDB]struct{} // All open databases

// chainId identifies the current chain and is used for replay protection
ChainID *big.Int `toml:"-"`
}

const (
Expand Down Expand Up @@ -200,6 +198,9 @@ func (n *Node) Start() error {
}
return err
}
func (n *Node) SetP2pChainID(ChainID *big.Int) {
n.server.ChainID = ChainID
}

// Close stops the Node and releases resources acquired in
// Node constructor New.
Expand Down
3 changes: 2 additions & 1 deletion p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ package p2p
import (
"crypto/ecdsa"
"errors"
"golang.org/x/crypto/sha3"
"math/big"
"math/rand"
"net"
"sync"
"sync/atomic"
"time"

"golang.org/x/crypto/sha3"

"github.com/AlayaNetwork/Alaya-Go/common"
"github.com/AlayaNetwork/Alaya-Go/common/mclock"
"github.com/AlayaNetwork/Alaya-Go/core/cbfttypes"
Expand Down

0 comments on commit 3cc9c75

Please sign in to comment.