core, network: request blocks instead of headers

Closes #1192

1. We now have CMDGetBlockByIndex, so there's no need to request headers
   first when we can just ask for blocks.
2. We don't ask for headers (i.e. we don't send CMDGetHeaders),
   consequently, we shouldn't react on CMDHeaders.
3. But we still keep on reacting on CMDGetHeaders command as
   there could be a node which needs headers.
This commit is contained in:
Anna Shaleva 2020-07-31 17:12:13 +03:00
parent f6f3863e0e
commit 6c8accf18c
3 changed files with 7 additions and 61 deletions

View file

@ -142,15 +142,3 @@ func TestServerNotSendsVerack(t *testing.T) {
assert.NotNil(t, err)
require.Equal(t, errAlreadyConnected, err)
}
func TestRequestHeaders(t *testing.T) {
var (
s = newTestServer(t, ServerConfig{})
p = newLocalPeer(t, s)
)
p.messageHandler = func(t *testing.T, msg *Message) {
assert.IsType(t, &payload.GetBlockByIndex{}, msg.Payload)
assert.Equal(t, CMDGetHeaders, msg.Command)
}
s.requestHeaders(p)
}