()
| 196 | } |
| 197 | |
| 198 | func 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 | } |
no test coverage detected