avoid generating cids on all messages before checking message length
This commit is contained in:
parent
39d609a661
commit
2fd860324f
@ -349,6 +349,10 @@ func zipTipSetAndMessages(bs cbor.IpldStore, ts *types.TipSet, allbmsgs []*types
|
|||||||
|
|
||||||
fts := &store.FullTipSet{}
|
fts := &store.FullTipSet{}
|
||||||
for bi, b := range ts.Blocks() {
|
for bi, b := range ts.Blocks() {
|
||||||
|
if msgc := len(bmi[bi]) + len(smi[bi]); msgc > build.BlockMessageLimit {
|
||||||
|
return nil, fmt.Errorf("block %q has too many messages (%d)", b.Cid(), msgc)
|
||||||
|
}
|
||||||
|
|
||||||
var smsgs []*types.SignedMessage
|
var smsgs []*types.SignedMessage
|
||||||
var smsgCids []cbg.CBORMarshaler
|
var smsgCids []cbg.CBORMarshaler
|
||||||
for _, m := range smi[bi] {
|
for _, m := range smi[bi] {
|
||||||
@ -365,10 +369,6 @@ func zipTipSetAndMessages(bs cbor.IpldStore, ts *types.TipSet, allbmsgs []*types
|
|||||||
bmsgCids = append(bmsgCids, &c)
|
bmsgCids = append(bmsgCids, &c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if msgc := len(bmsgCids) + len(smsgCids); msgc > build.BlockMessageLimit {
|
|
||||||
return nil, fmt.Errorf("block %q has too many messages (%d)", b.Cid(), msgc)
|
|
||||||
}
|
|
||||||
|
|
||||||
mrcid, err := computeMsgMeta(bs, bmsgCids, smsgCids)
|
mrcid, err := computeMsgMeta(bs, bmsgCids, smsgCids)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user