mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-15 09:20:44 +00:00
add xdpos2 protocol condition
This commit is contained in:
parent
1b781530c6
commit
9e04fd82cf
2 changed files with 20 additions and 0 deletions
|
|
@ -207,6 +207,14 @@ func newTestPeer(name string, version int, pm *ProtocolManager, shake bool) (*te
|
||||||
func (p *testPeer) handshake(t *testing.T, td *big.Int, head common.Hash, genesis common.Hash, forkID forkid.ID, forkFilter forkid.Filter) {
|
func (p *testPeer) handshake(t *testing.T, td *big.Int, head common.Hash, genesis common.Hash, forkID forkid.ID, forkFilter forkid.Filter) {
|
||||||
var msg interface{}
|
var msg interface{}
|
||||||
switch {
|
switch {
|
||||||
|
case p.version == xdpos2:
|
||||||
|
msg = &statusData63{
|
||||||
|
ProtocolVersion: uint32(p.version),
|
||||||
|
NetworkId: DefaultConfig.NetworkId,
|
||||||
|
TD: td,
|
||||||
|
CurrentBlock: head,
|
||||||
|
GenesisBlock: genesis,
|
||||||
|
}
|
||||||
case p.version == eth63:
|
case p.version == eth63:
|
||||||
msg = &statusData63{
|
msg = &statusData63{
|
||||||
ProtocolVersion: uint32(p.version),
|
ProtocolVersion: uint32(p.version),
|
||||||
|
|
|
||||||
12
eth/peer.go
12
eth/peer.go
|
|
@ -783,6 +783,14 @@ func (p *peer) Handshake(network uint64, td *big.Int, head common.Hash, genesis
|
||||||
)
|
)
|
||||||
go func() {
|
go func() {
|
||||||
switch {
|
switch {
|
||||||
|
case p.version == xdpos2:
|
||||||
|
errc <- p2p.Send(p.rw, StatusMsg, &statusData63{
|
||||||
|
ProtocolVersion: uint32(p.version),
|
||||||
|
NetworkId: network,
|
||||||
|
TD: td,
|
||||||
|
CurrentBlock: head,
|
||||||
|
GenesisBlock: genesis,
|
||||||
|
})
|
||||||
case p.version == eth63:
|
case p.version == eth63:
|
||||||
errc <- p2p.Send(p.rw, StatusMsg, &statusData63{
|
errc <- p2p.Send(p.rw, StatusMsg, &statusData63{
|
||||||
ProtocolVersion: uint32(p.version),
|
ProtocolVersion: uint32(p.version),
|
||||||
|
|
@ -806,6 +814,8 @@ func (p *peer) Handshake(network uint64, td *big.Int, head common.Hash, genesis
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
switch {
|
switch {
|
||||||
|
case p.version == xdpos2:
|
||||||
|
errc <- p.readStatusLegacy(network, &status63, genesis)
|
||||||
case p.version == eth63:
|
case p.version == eth63:
|
||||||
errc <- p.readStatusLegacy(network, &status63, genesis)
|
errc <- p.readStatusLegacy(network, &status63, genesis)
|
||||||
case p.version >= eth64:
|
case p.version >= eth64:
|
||||||
|
|
@ -827,6 +837,8 @@ func (p *peer) Handshake(network uint64, td *big.Int, head common.Hash, genesis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
|
case p.version == xdpos2:
|
||||||
|
p.td, p.head = status63.TD, status63.CurrentBlock
|
||||||
case p.version == eth63:
|
case p.version == eth63:
|
||||||
p.td, p.head = status63.TD, status63.CurrentBlock
|
p.td, p.head = status63.TD, status63.CurrentBlock
|
||||||
case p.version >= eth64:
|
case p.version >= eth64:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue