650a31b050
events adapter implement StateWaitMsg and StateComputeDataCommitment implement StateGetSectorPreCommitOnChainInfo implement ChainHead and SendMsg implement remaining methods
30 lines
826 B
Go
30 lines
826 B
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
|
|
"github.com/filecoin-project/lotus/chain/events"
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
"github.com/filecoin-project/lotus/storage/sealing"
|
|
)
|
|
|
|
var _ sealing.Events = new(EventsAdapter)
|
|
|
|
type EventsAdapter struct {
|
|
delegate events.Events
|
|
}
|
|
|
|
func NewEventsAdapter(api events.Events) EventsAdapter {
|
|
return EventsAdapter{delegate: api}
|
|
}
|
|
|
|
func (e EventsAdapter) ChainAt(hnd sealing.HeightHandler, rev sealing.RevertHandler, confidence int, h abi.ChainEpoch) error {
|
|
return e.delegate.ChainAt(func(ctx context.Context, ts *types.TipSet, curH abi.ChainEpoch) error {
|
|
return hnd(ctx, ts.Key().Bytes(), curH)
|
|
}, func(ctx context.Context, ts *types.TipSet) error {
|
|
return rev(ctx, ts.Key().Bytes())
|
|
}, confidence, h)
|
|
}
|