Merge pull request #4366 from zgfzgf/feat-applyblocks-map

optimize map use struct{}
This commit is contained in:
Łukasz Magiera 2020-10-15 03:04:57 +02:00 committed by GitHub
commit 22f49f8946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
} }
var receipts []cbg.CBORMarshaler var receipts []cbg.CBORMarshaler
processedMsgs := map[cid.Cid]bool{} processedMsgs := make(map[cid.Cid]struct{})
for _, b := range bms { for _, b := range bms {
penalty := types.NewInt(0) penalty := types.NewInt(0)
gasReward := big.Zero() gasReward := big.Zero()
@ -333,7 +333,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
return cid.Undef, cid.Undef, err return cid.Undef, cid.Undef, err
} }
} }
processedMsgs[m.Cid()] = true processedMsgs[m.Cid()] = struct{}{}
} }
params, err := actors.SerializeParams(&reward.AwardBlockRewardParams{ params, err := actors.SerializeParams(&reward.AwardBlockRewardParams{