View definition

func GenerateChain(config *ChainConfig, parent *Block, db Database, n int, gen func(int, *BlockGen)) ([]*Block, []Receipts)

Defined in


GenerateChain creates a chain of n blocks. The first block’s parent will be the provided parent. db is used to store intermediate states and should contain the parent’s state trie.

The generator function is called with a new block generator for every block. Any transactions and uncles added to the generator become part of the block. If gen is nil, the blocks will be empty and their coinbase will be the zero address.

Blocks created by GenerateChain do not contain valid proof of work values. Inserting them into BlockChain requires use of FakePow or a similar non-validating proof of work implementation.

GenerateChain is referenced in 1 repository