diff options
author | zelig <viktor.tron@gmail.com> | 2015-04-01 19:36:49 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-04-01 19:36:49 +0800 |
commit | f56fc9cd9d13e88ee1a244ea590e249e324b8b84 (patch) | |
tree | c5b31c90566931e6a1a859f98da549181805f62c /eth | |
parent | 6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e (diff) | |
download | go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.tar go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.tar.gz go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.tar.bz2 go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.tar.lz go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.tar.xz go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.tar.zst go-tangerine-f56fc9cd9d13e88ee1a244ea590e249e324b8b84.zip |
change StatusMsgData.TD back to pointer type *big.Int
Diffstat (limited to 'eth')
-rw-r--r-- | eth/protocol.go | 6 | ||||
-rw-r--r-- | eth/protocol_test.go | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/eth/protocol.go b/eth/protocol.go index 214eed875..a0ab177cd 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -105,7 +105,7 @@ type getBlockHashesMsgData struct { type statusMsgData struct { ProtocolVersion uint32 NetworkId uint32 - TD big.Int + TD *big.Int CurrentBlock common.Hash GenesisBlock common.Hash } @@ -344,7 +344,7 @@ func (self *ethProtocol) handleStatus() error { return self.protoError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, self.protocolVersion) } - _, suspended := self.blockPool.AddPeer(&status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) + _, suspended := self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) if suspended { return self.protoError(ErrSuspendedPeer, "") } @@ -375,7 +375,7 @@ func (self *ethProtocol) sendStatus() error { return p2p.Send(self.rw, StatusMsg, &statusMsgData{ ProtocolVersion: uint32(self.protocolVersion), NetworkId: uint32(self.networkId), - TD: *td, + TD: td, CurrentBlock: currentBlock, GenesisBlock: genesisBlock, }) diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 2228fa0ec..d3466326a 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -173,7 +173,7 @@ func (self *ethProtocolTester) handshake(t *testing.T, mock bool) { err := p2p.ExpectMsg(self, StatusMsg, &statusMsgData{ ProtocolVersion: ProtocolVersion, NetworkId: NetworkId, - TD: *td, + TD: td, CurrentBlock: currentBlock, GenesisBlock: genesis, }) @@ -181,7 +181,7 @@ func (self *ethProtocolTester) handshake(t *testing.T, mock bool) { t.Fatalf("incorrect outgoing status: %v", err) } if mock { - go p2p.Send(self, StatusMsg, &statusMsgData{ProtocolVersion, NetworkId, *td, currentBlock, genesis}) + go p2p.Send(self, StatusMsg, &statusMsgData{ProtocolVersion, NetworkId, td, currentBlock, genesis}) } } @@ -201,15 +201,15 @@ func TestStatusMsgErrors(t *testing.T) { wantErrorCode: ErrNoStatusMsg, }, { - code: StatusMsg, data: statusMsgData{10, NetworkId, *td, currentBlock, genesis}, + code: StatusMsg, data: statusMsgData{10, NetworkId, td, currentBlock, genesis}, wantErrorCode: ErrProtocolVersionMismatch, }, { - code: StatusMsg, data: statusMsgData{ProtocolVersion, 999, *td, currentBlock, genesis}, + code: StatusMsg, data: statusMsgData{ProtocolVersion, 999, td, currentBlock, genesis}, wantErrorCode: ErrNetworkIdMismatch, }, { - code: StatusMsg, data: statusMsgData{ProtocolVersion, NetworkId, *td, currentBlock, common.Hash{3}}, + code: StatusMsg, data: statusMsgData{ProtocolVersion, NetworkId, td, currentBlock, common.Hash{3}}, wantErrorCode: ErrGenesisBlockMismatch, }, } |