// performInception restore genesis data from the a directory or JSON contents expected to exist at the birth of any
// node in this ledgers network.
//
// An account state may be specified within the genesis directory in the form of a [account address].json file with key
// value pairs.
//
// A smart contract may be specified within the genesis directory in the form of a [contract address].wasm file with
// accompanying [contract address].[page index].dmp files representing the contracts memory pages.
//
// The AccountsLen in the restored tree may not match with the original tree.
//
// If the genesis is nil, restore from the hardcoded default genesis.
performInception restore genesis data from the a directory or JSON contents expected to exist at the birth of any
node in this ledgers network.

An account state may be specified within the genesis directory in the form of a [account address].json file with key
value pairs.

A smart contract may be specified within the genesis directory in the form of a [contract address].wasm file with
accompanying [contract address].[page index].dmp files representing the contracts memory pages.

The AccountsLen in the restored tree may not match with the original tree.

If the genesis is nil, restore from the hardcoded default genesis.
// performInception restore genesis data from the a directory or JSON contents expected to exist at the birth of any // node in this ledgers network . // // An account state may be specified within the genesis directory in the form of a [ account address ] . json file with key // value pairs . // // A smart contract may be specified within the genesis directory in the form of a [ contract address ] . wasm file with // accompanying [ contract address ] . [ page index ] . dmp files representing the contracts memory pages . // // The AccountsLen in the restored tree may not match with the original tree . // // If the genesis is nil restore from the hardcoded default genesis .
func performInception(tree *avl.Tree, genesis *string) Block {
	logger := log.Node()
	var err error
	if genesis != nil {
		isJSON := func(str string) bool {
			var js json.RawMessage
			return json.Unmarshal([]byte(str), &js) == nil
		}
		if isJSON(*genesis) {
			err = restoreFromJSON(tree, []byte(*genesis))
		} else {
			err = restoreFromDir(tree, *genesis)
		}
	} else {
		err = restoreFromJSON(tree, []byte(defaultGenesis))
	}
	if err != nil {
		logger.Fatal().Err(err).Msg("genesis")
	}
	return NewBlock(0, tree.Checksum())
}
func performInception ( tree * avl . Tree , genesis * string ) Block { logger := log . Node ( ) var err error if genesis != nil { isJSON := func ( str string ) bool { var js json . RawMessage return json . Unmarshal ( [ ] byte ( str ) , & js ) == nil } if isJSON ( * genesis ) { err = restoreFromJSON ( tree , [ ] byte ( * genesis ) ) } else { err = restoreFromDir ( tree , * genesis ) } } else { err = restoreFromJSON ( tree , [ ] byte ( defaultGenesis ) ) } if err != nil { logger . Fatal ( ) . Err ( err ) . Msg ( " " ) } return NewBlock ( 0 , tree . Checksum ( ) ) }
performInception restore genesis data from the a directory or JSON contents expected to exist at the birth of any
node in this ledgers network.
performInception restore genesis data from the a directory or JSON contents expected to exist at the birth of any node in this ledgers network .