forked from cerc-io/ipld-eth-server
16 lines
499 B
Go
16 lines
499 B
Go
|
package history
|
||
|
|
||
|
import (
|
||
|
"github.com/8thlight/vulcanizedb/pkg/core"
|
||
|
"github.com/8thlight/vulcanizedb/pkg/repositories"
|
||
|
)
|
||
|
|
||
|
func PopulateBlocks(blockchain core.Blockchain, repository repositories.Repository, startingBlockNumber int64) int {
|
||
|
blockNumbers := repository.MissingBlockNumbers(startingBlockNumber, repository.MaxBlockNumber())
|
||
|
for _, blockNumber := range blockNumbers {
|
||
|
block := blockchain.GetBlockByNumber(blockNumber)
|
||
|
repository.CreateBlock(block)
|
||
|
}
|
||
|
return len(blockNumbers)
|
||
|
}
|