aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-30 01:30:05 +0800
committerzelig <viktor.tron@gmail.com>2014-06-30 01:30:05 +0800
commitdabaa4cce01586fd8b1b9314073a1d26f35355c8 (patch)
treefff48b2c62a1d717a7d95ffb99e9eb1d99dbf7bb /peer.go
parent707d413761927f5ad95298e666e297b820ad0901 (diff)
downloadgo-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.tar
go-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.tar.gz
go-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.tar.bz2
go-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.tar.lz
go-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.tar.xz
go-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.tar.zst
go-tangerine-dabaa4cce01586fd8b1b9314073a1d26f35355c8.zip
change all modified calls to ethtrie, ethutil and ethcrypto functions
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go20
1 files changed, 8 insertions, 12 deletions
diff --git a/peer.go b/peer.go
index e50fd43f9..ffabb8f49 100644
--- a/peer.go
+++ b/peer.go
@@ -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
-
- msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
- uint32(ProtocolVersion), uint32(0), []byte(p.version), byte(p.caps), p.port, pubkey[1:],
- })
+ 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:],
+ })
- 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