extra check in toFullTipSets
This commit is contained in:
parent
3f6c418dc6
commit
97b37474f9
@ -163,11 +163,11 @@ type validatedResponse struct {
|
|||||||
// Decompress messages and form full tipsets with them. The headers
|
// Decompress messages and form full tipsets with them. The headers
|
||||||
// need to have been requested as well.
|
// need to have been requested as well.
|
||||||
func (res *validatedResponse) toFullTipSets() ([]*store.FullTipSet) {
|
func (res *validatedResponse) toFullTipSets() ([]*store.FullTipSet) {
|
||||||
if len(res.tipsets) == 0 {
|
if len(res.tipsets) == 0 || len(res.tipsets) != len(res.messages) {
|
||||||
// This decompression can only be done if both headers and
|
// This decompression can only be done if both headers and
|
||||||
// messages are returned in the response.
|
// messages are returned in the response. (The second check
|
||||||
// FIXME: Do we need to check the messages are present also? The validation
|
// is already implied by the guarantees of `validatedResponse`,
|
||||||
// would seem to imply this is unnecessary, can be added just in case.
|
// added here just for completeness.)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ftsList := make([]*store.FullTipSet, len(res.tipsets))
|
ftsList := make([]*store.FullTipSet, len(res.tipsets))
|
||||||
|
Loading…
Reference in New Issue
Block a user