change all modified calls to ethtrie, ethutil and ethcrypto functions

This commit is contained in:
zelig
2014-06-29 18:30:05 +01:00
parent 707d413761
commit dabaa4cce0
14 changed files with 91 additions and 83 deletions

20
peer.go
View File

@ -146,7 +146,7 @@ type Peer struct {
}
func NewPeer(conn net.Conn, ethereum *Ethereum, inbound bool) *Peer {
pubkey := ethutil.GetKeyRing().Get(0).PublicKey[1:]
pubkey := ethereum.KeyManager().PublicKey()[1:]
return &Peer{
outputQueue: make(chan *ethwire.Msg, outputBufferSize),
@ -590,16 +590,12 @@ func (p *Peer) Stop() {
}
func (p *Peer) pushHandshake() error {
keyRing := ethutil.GetKeyRing().Get(0)
if keyRing != nil {
pubkey := keyRing.PublicKey
pubkey := p.ethereum.KeyManager().PublicKey()
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
uint32(ProtocolVersion), uint32(0), []byte(p.version), byte(p.caps), p.port, pubkey[1:],
})
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
uint32(ProtocolVersion), uint32(0), []byte(p.version), byte(p.caps), p.port, pubkey[1:],
})
p.QueueMessage(msg)
}
p.QueueMessage(msg)
return nil
}
@ -664,8 +660,8 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
p.port = uint16(c.Get(4).Uint())
// Self connect detection
keyPair := ethutil.GetKeyRing().Get(0)
if bytes.Compare(keyPair.PublicKey, p.pubkey) == 0 {
pubkey := p.ethereum.KeyManager().PublicKey()
if bytes.Compare(pubkey, p.pubkey) == 0 {
p.Stop()
return