(ctx *cli.Context)
| 223 | } |
| 224 | |
| 225 | func initAccount(ctx *cli.Context) (*account.Account, error) { |
| 226 | if !config.DefConfig.Consensus.EnableConsensus { |
| 227 | return nil, nil |
| 228 | } |
| 229 | walletFile := ctx.GlobalString(utils.GetFlagName(utils.WalletFileFlag)) |
| 230 | if walletFile == "" { |
| 231 | return nil, fmt.Errorf("Please config wallet file using --wallet flag") |
| 232 | } |
| 233 | if !common.FileExisted(walletFile) { |
| 234 | return nil, fmt.Errorf("Cannot find wallet file: %s. Please create a wallet first", walletFile) |
| 235 | } |
| 236 | |
| 237 | acc, err := cmdcom.GetAccount(ctx) |
| 238 | if err != nil { |
| 239 | return nil, fmt.Errorf("get account error: %s", err) |
| 240 | } |
| 241 | log.Infof("Using account: %s", acc.Address.ToBase58()) |
| 242 | |
| 243 | if config.DefConfig.Genesis.ConsensusType == config.CONSENSUS_TYPE_SOLO { |
| 244 | curPk := hex.EncodeToString(keypair.SerializePublicKey(acc.PublicKey)) |
| 245 | config.DefConfig.Genesis.SOLO.Bookkeepers = []string{curPk} |
| 246 | } |
| 247 | |
| 248 | log.Infof("Account init success") |
| 249 | return acc, nil |
| 250 | } |
| 251 | |
| 252 | func initLedger(ctx *cli.Context, stateHashHeight uint32) (*ledger.Ledger, error) { |
| 253 | events.Init() //Init event hub |
no test coverage detected