You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.3 KiB
32 lines
1.3 KiB
package downloader
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/event"
|
|
"github.com/woop-chain/woop/consensus/engine"
|
|
"github.com/woop-chain/woop/core/types"
|
|
"github.com/woop-chain/woop/p2p/stream/common/streammanager"
|
|
syncproto "github.com/woop-chain/woop/p2p/stream/protocols/sync"
|
|
sttypes "github.com/woop-chain/woop/p2p/stream/types"
|
|
)
|
|
|
|
type syncProtocol interface {
|
|
GetCurrentBlockNumber(ctx context.Context, opts ...syncproto.Option) (uint64, sttypes.StreamID, error)
|
|
GetBlocksByNumber(ctx context.Context, bns []uint64, opts ...syncproto.Option) ([]*types.Block, sttypes.StreamID, error)
|
|
GetBlockHashes(ctx context.Context, bns []uint64, opts ...syncproto.Option) ([]common.Hash, sttypes.StreamID, error)
|
|
GetBlocksByHashes(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) ([]*types.Block, sttypes.StreamID, error)
|
|
|
|
RemoveStream(stID sttypes.StreamID) // If a stream delivers invalid data, remove the stream
|
|
SubscribeAddStreamEvent(ch chan<- streammanager.EvtStreamAdded) event.Subscription
|
|
NumStreams() int
|
|
}
|
|
|
|
type blockChain interface {
|
|
engine.ChainReader
|
|
Engine() engine.Engine
|
|
|
|
InsertChain(chain types.Blocks, verifyHeaders bool) (int, error)
|
|
WriteCommitSig(blockNum uint64, lastCommits []byte) error
|
|
}
|
|
|