eth, les: shorten genesis block mismatch error message

This commit is contained in:
Felix Lange 2017-02-27 13:53:30 +01:00
parent fc97c7a38d
commit 35e8308bf7
3 changed files with 3 additions and 3 deletions

View File

@ -280,7 +280,7 @@ func (p *peer) readStatus(network int, status *statusData, genesis common.Hash)
return errResp(ErrDecode, "msg %v: %v", msg, err) return errResp(ErrDecode, "msg %v: %v", msg, err)
} }
if status.GenesisBlock != genesis { if status.GenesisBlock != genesis {
return errResp(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock, genesis) return errResp(ErrGenesisBlockMismatch, "%x (!= %x)", status.GenesisBlock[:8], genesis[:8])
} }
if int(status.NetworkId) != network { if int(status.NetworkId) != network {
return errResp(ErrNetworkIdMismatch, "%d (!= %d)", status.NetworkId, network) return errResp(ErrNetworkIdMismatch, "%d (!= %d)", status.NetworkId, network)

View File

@ -63,7 +63,7 @@ func testStatusMsgErrors(t *testing.T, protocol int) {
}, },
{ {
code: StatusMsg, data: statusData{uint32(protocol), NetworkId, td, currentBlock, common.Hash{3}}, code: StatusMsg, data: statusData{uint32(protocol), NetworkId, td, currentBlock, common.Hash{3}},
wantError: errResp(ErrGenesisBlockMismatch, "0300000000000000000000000000000000000000000000000000000000000000 (!= %x)", genesis), wantError: errResp(ErrGenesisBlockMismatch, "0300000000000000 (!= %x)", genesis[:8]),
}, },
} }

View File

@ -367,7 +367,7 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis
} }
if rGenesis != genesis { if rGenesis != genesis {
return errResp(ErrGenesisBlockMismatch, "%x (!= %x)", rGenesis, genesis) return errResp(ErrGenesisBlockMismatch, "%x (!= %x)", rGenesis[:8], genesis[:8])
} }
if int(rNetwork) != p.network { if int(rNetwork) != p.network {
return errResp(ErrNetworkIdMismatch, "%d (!= %d)", rNetwork, p.network) return errResp(ErrNetworkIdMismatch, "%d (!= %d)", rNetwork, p.network)