good morning!!!!

Skip to content
Snippets Groups Projects
Commit 86d1a26b authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

fixed status message

parent 742a9b00
Branches
Tags
No related merge requests found
...@@ -634,8 +634,8 @@ func (self *Peer) pushStatus() { ...@@ -634,8 +634,8 @@ func (self *Peer) pushStatus() {
const netVersion = 0 const netVersion = 0
msg := ethwire.NewMessage(ethwire.MsgStatusTy, []interface{}{ msg := ethwire.NewMessage(ethwire.MsgStatusTy, []interface{}{
uint32(ProtocolVersion), uint32(ProtocolVersion),
netVersion, uint32(netVersion),
self.ethereum.BlockChain().TD.Uint64(), self.ethereum.BlockChain().TD,
self.ethereum.BlockChain().CurrentBlock.Hash(), self.ethereum.BlockChain().CurrentBlock.Hash(),
self.ethereum.BlockChain().Genesis().Hash(), self.ethereum.BlockChain().Genesis().Hash(),
}) })
...@@ -645,13 +645,22 @@ func (self *Peer) pushStatus() { ...@@ -645,13 +645,22 @@ func (self *Peer) pushStatus() {
func (self *Peer) handleStatus(msg *ethwire.Msg) { func (self *Peer) handleStatus(msg *ethwire.Msg) {
c := msg.Data c := msg.Data
// Set the peer's caps
//p.caps = Caps(c.Get(3).Byte()) var (
protoVersion = c.Get(0).Uint()
netVersion = c.Get(1).Uint()
td = c.Get(2).BigInt()
bestHash = c.Get(3).Bytes()
genesis = c.Get(4).Bytes()
)
ethlogger.Infof("gen = %x\n", genesis)
// Get the td and last hash // Get the td and last hash
self.td = c.Get(6).BigInt() self.td = td
self.bestHash = c.Get(7).Bytes() self.bestHash = bestHash
self.lastReceivedHash = self.bestHash self.lastReceivedHash = bestHash
self.statusKnown = true
// Compare the total TD with the blockchain TD. If remote is higher // Compare the total TD with the blockchain TD. If remote is higher
// fetch hashes from highest TD node. // fetch hashes from highest TD node.
...@@ -660,13 +669,14 @@ func (self *Peer) handleStatus(msg *ethwire.Msg) { ...@@ -660,13 +669,14 @@ func (self *Peer) handleStatus(msg *ethwire.Msg) {
self.FetchHashes() self.FetchHashes()
} }
ethlogger.Infof("Peer is [ETH] capable. (TD = %v ~ %x", self.td, self.bestHash) ethlogger.Infof("Peer is [ETH] capable. (TD = %v ~ %x) %d / %d", self.td, self.bestHash, protoVersion, netVersion)
} }
func (p *Peer) pushHandshake() error { func (p *Peer) pushHandshake() error {
pubkey := p.ethereum.KeyManager().PublicKey() pubkey := p.ethereum.KeyManager().PublicKey()
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{ msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
uint32(0), []byte(p.version), []string{"eth"}, uint32(30303) /*p.port*/, pubkey[1:], P2PVersion, []byte(p.version), []interface{}{"eth"}, uint32(30303) /*p.port*/, pubkey[1:],
}) })
p.QueueMessage(msg) p.QueueMessage(msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment