mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 02:47:48 +08:00
- Modified Godeps/Godeps.json by hand - [TEST] Updated welcome docs hash to sharness - [TEST] Updated contact doc - [TEST] disabled breaking test (t0080-repo refs local)
26 lines
468 B
Go
26 lines
468 B
Go
package blocksutil
|
|
|
|
import "github.com/ipfs/go-ipfs/blocks"
|
|
|
|
func NewBlockGenerator() BlockGenerator {
|
|
return BlockGenerator{}
|
|
}
|
|
|
|
type BlockGenerator struct {
|
|
seq int
|
|
}
|
|
|
|
func (bg *BlockGenerator) Next() *blocks.Block {
|
|
bg.seq++
|
|
return blocks.NewBlock([]byte(string(bg.seq)))
|
|
}
|
|
|
|
func (bg *BlockGenerator) Blocks(n int) []*blocks.Block {
|
|
blocks := make([]*blocks.Block, 0)
|
|
for i := 0; i < n; i++ {
|
|
b := bg.Next()
|
|
blocks = append(blocks, b)
|
|
}
|
|
return blocks
|
|
}
|