document NewTipSet checks
This commit is contained in:
parent
9f82e98f28
commit
1ec0ded953
@ -97,6 +97,12 @@ func tipsetSortFunc(blks []*BlockHeader) func(i, j int) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks:
|
||||||
|
// * A tipset is composed of at least one block. (Because of our variable
|
||||||
|
// number of blocks per tipset, determined by randomness, we do not impose
|
||||||
|
// an upper limit.)
|
||||||
|
// * All blocks have the same height.
|
||||||
|
// * All blocks have the same parents (same number of them and matching CIDs).
|
||||||
func NewTipSet(blks []*BlockHeader) (*TipSet, error) {
|
func NewTipSet(blks []*BlockHeader) (*TipSet, error) {
|
||||||
if len(blks) == 0 {
|
if len(blks) == 0 {
|
||||||
return nil, xerrors.Errorf("NewTipSet called with zero length array of blocks")
|
return nil, xerrors.Errorf("NewTipSet called with zero length array of blocks")
|
||||||
|
Loading…
Reference in New Issue
Block a user