forked from cerc-io/plugeth
Interop!
This commit is contained in:
parent
5a83114efd
commit
02acef23d5
@ -60,8 +60,8 @@ type Ethereum struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(caps Caps, usePnp bool) (*Ethereum, error) {
|
func New(caps Caps, usePnp bool) (*Ethereum, error) {
|
||||||
db, err := ethdb.NewLDBDatabase()
|
//db, err := ethdb.NewLDBDatabase()
|
||||||
//db, err := ethdb.NewMemDatabase()
|
db, err := ethdb.NewMemDatabase()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -246,6 +246,8 @@ func (s *Ethereum) Start() {
|
|||||||
// Start the tx pool
|
// Start the tx pool
|
||||||
s.TxPool.Start()
|
s.TxPool.Start()
|
||||||
|
|
||||||
|
if ethutil.Config.Seed {
|
||||||
|
// Testnet seed bootstrapping
|
||||||
resp, err := http.Get("http://www.ethereum.org/servers.poc2.txt")
|
resp, err := http.Get("http://www.ethereum.org/servers.poc2.txt")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Fetching seed failed:", err)
|
log.Println("Fetching seed failed:", err)
|
||||||
@ -260,6 +262,7 @@ func (s *Ethereum) Start() {
|
|||||||
|
|
||||||
s.ConnectToPeer(string(body))
|
s.ConnectToPeer(string(body))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Ethereum) peerHandler(listener net.Listener) {
|
func (s *Ethereum) peerHandler(listener net.Listener) {
|
||||||
for {
|
for {
|
||||||
|
7
peer.go
7
peer.go
@ -204,6 +204,7 @@ func (p *Peer) HandleOutbound() {
|
|||||||
// The ping timer. Makes sure that every 2 minutes a ping is send to the peer
|
// The ping timer. Makes sure that every 2 minutes a ping is send to the peer
|
||||||
pingTimer := time.NewTicker(2 * time.Minute)
|
pingTimer := time.NewTicker(2 * time.Minute)
|
||||||
serviceTimer := time.NewTicker(5 * time.Minute)
|
serviceTimer := time.NewTicker(5 * time.Minute)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -442,7 +443,7 @@ func (p *Peer) pushHandshake() error {
|
|||||||
|
|
||||||
clientId := fmt.Sprintf("/Ethereum(G) v%s/%s", ethutil.Config.Ver, runtime.GOOS)
|
clientId := fmt.Sprintf("/Ethereum(G) v%s/%s", ethutil.Config.Ver, runtime.GOOS)
|
||||||
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
|
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
|
||||||
uint32(3), uint32(0), clientId, byte(p.caps), p.port, pubkey,
|
uint32(4), uint32(0), clientId, byte(p.caps), p.port, pubkey,
|
||||||
})
|
})
|
||||||
|
|
||||||
p.QueueMessage(msg)
|
p.QueueMessage(msg)
|
||||||
@ -469,8 +470,8 @@ func (p *Peer) pushPeers() {
|
|||||||
func (p *Peer) handleHandshake(msg *ethwire.Msg) {
|
func (p *Peer) handleHandshake(msg *ethwire.Msg) {
|
||||||
c := msg.Data
|
c := msg.Data
|
||||||
|
|
||||||
if c.Get(0).AsUint() != 3 {
|
if c.Get(0).AsUint() != 4 {
|
||||||
log.Println("Invalid peer version. Require protocol v3")
|
log.Println("Invalid peer version. Require protocol v4")
|
||||||
p.Stop()
|
p.Stop()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user