Skip to content

Commit f56fc9c

Browse files
committed
change StatusMsgData.TD back to pointer type *big.Int
1 parent 6ffea34 commit f56fc9c

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎eth/protocol.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ type getBlockHashesMsgData struct {
105105
type statusMsgData struct {
106106
ProtocolVersion uint32
107107
NetworkId uint32
108-
TD big.Int
108+
TD *big.Int
109109
CurrentBlock common.Hash
110110
GenesisBlock common.Hash
111111
}
@@ -344,7 +344,7 @@ func (self *ethProtocol) handleStatus() error {
344344
return self.protoError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, self.protocolVersion)
345345
}
346346

347-
_, suspended := self.blockPool.AddPeer(&status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect)
347+
_, suspended := self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect)
348348
if suspended {
349349
return self.protoError(ErrSuspendedPeer, "")
350350
}
@@ -375,7 +375,7 @@ func (self *ethProtocol) sendStatus() error {
375375
return p2p.Send(self.rw, StatusMsg, &statusMsgData{
376376
ProtocolVersion: uint32(self.protocolVersion),
377377
NetworkId: uint32(self.networkId),
378-
TD: *td,
378+
TD: td,
379379
CurrentBlock: currentBlock,
380380
GenesisBlock: genesisBlock,
381381
})

‎eth/protocol_test.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ func (self *ethProtocolTester) handshake(t *testing.T, mock bool) {
173173
err := p2p.ExpectMsg(self, StatusMsg, &statusMsgData{
174174
ProtocolVersion: ProtocolVersion,
175175
NetworkId: NetworkId,
176-
TD: *td,
176+
TD: td,
177177
CurrentBlock: currentBlock,
178178
GenesisBlock: genesis,
179179
})
180180
if err != nil {
181181
t.Fatalf("incorrect outgoing status: %v", err)
182182
}
183183
if mock {
184-
go p2p.Send(self, StatusMsg, &statusMsgData{ProtocolVersion, NetworkId, *td, currentBlock, genesis})
184+
go p2p.Send(self, StatusMsg, &statusMsgData{ProtocolVersion, NetworkId, td, currentBlock, genesis})
185185
}
186186
}
187187

@@ -201,15 +201,15 @@ func TestStatusMsgErrors(t *testing.T) {
201201
wantErrorCode: ErrNoStatusMsg,
202202
},
203203
{
204-
code: StatusMsg, data: statusMsgData{10, NetworkId, *td, currentBlock, genesis},
204+
code: StatusMsg, data: statusMsgData{10, NetworkId, td, currentBlock, genesis},
205205
wantErrorCode: ErrProtocolVersionMismatch,
206206
},
207207
{
208-
code: StatusMsg, data: statusMsgData{ProtocolVersion, 999, *td, currentBlock, genesis},
208+
code: StatusMsg, data: statusMsgData{ProtocolVersion, 999, td, currentBlock, genesis},
209209
wantErrorCode: ErrNetworkIdMismatch,
210210
},
211211
{
212-
code: StatusMsg, data: statusMsgData{ProtocolVersion, NetworkId, *td, currentBlock, common.Hash{3}},
212+
code: StatusMsg, data: statusMsgData{ProtocolVersion, NetworkId, td, currentBlock, common.Hash{3}},
213213
wantErrorCode: ErrGenesisBlockMismatch,
214214
},
215215
}

0 commit comments

Comments
 (0)