MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / loadGenesis

Function loadGenesis

cmd/cqld/bootstrap.go:198–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196}
197
198func loadGenesis() (genesis *types.BPBlock, err error) {
199 genesisInfo := conf.GConf.BP.BPGenesis
200 log.WithField("config", genesisInfo).Info("load genesis config")
201
202 genesis = &types.BPBlock{
203 SignedHeader: types.BPSignedHeader{
204 BPHeader: types.BPHeader{
205 Version: genesisInfo.Version,
206 Timestamp: genesisInfo.Timestamp,
207 },
208 },
209 }
210
211 for _, ba := range genesisInfo.BaseAccounts {
212 log.WithFields(log.Fields{
213 "address": ba.Address.String(),
214 "stableCoinBalance": ba.StableCoinBalance,
215 "covenantCoinBalance": ba.CovenantCoinBalance,
216 }).Debug("setting one balance fixture in genesis block")
217 genesis.Transactions = append(genesis.Transactions, types.NewBaseAccount(
218 &types.Account{
219 Address: proto.AccountAddress(ba.Address),
220 TokenBalance: [types.SupportTokenNumber]uint64{ba.StableCoinBalance, ba.CovenantCoinBalance},
221 }))
222 }
223
224 // Rewrite genesis merkle and block hash
225 if err = genesis.SetHash(); err != nil {
226 return
227 }
228 return
229}

Callers 1

runNodeFunction · 0.85

Calls 8

WithFieldFunction · 0.92
WithFieldsFunction · 0.92
NewBaseAccountFunction · 0.92
AccountAddressTypeAlias · 0.92
InfoMethod · 0.80
DebugMethod · 0.80
SetHashMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected