Skip to content

Commit

Permalink
fix: fix store receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Feb 22, 2023
1 parent f793676 commit 089881e
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions pkg/chain/message_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,25 +329,14 @@ func (ms *MessageStore) LoadReceipts(ctx context.Context, c cid.Cid) ([]types.Me
// StoreReceipts puts the input signed messages to a collection and then writes
// this collection to ipld storage. The cid of the collection is returned.
func (ms *MessageStore) StoreReceipts(ctx context.Context, receipts []types.MessageReceipt) (cid.Cid, error) {
tmp := blockstoreutil.NewTemporary()
rectarr := adt.MakeEmptyArray(adt.WrapStore(ctx, cbor.NewCborStore(tmp)))
rectarr := adt.MakeEmptyArray(adt.WrapStore(ctx, cbor.NewCborStore(ms.bs)))

for i, receipt := range receipts {
if err := rectarr.Set(uint64(i), &receipt); err != nil {
return cid.Undef, errors.Wrap(err, "failed to build receipts amt")
}
}

root, err := rectarr.Root()
if err != nil {
return cid.Undef, err
}

err = blockstoreutil.CopyParticial(ctx, tmp, ms.bs, root)
if err != nil {
return cid.Undef, err
}

return rectarr.Root()
}

Expand Down

0 comments on commit 089881e

Please sign in to comment.