Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#215 Fix gentx commands. #218

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (app *CyberdApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) ab
// load the accounts
for _, gacc := range genesisState.Accounts {
acc := gacc.ToAccount()
acc.AccountNumber = app.accountKeeper.GetNextAccountNumber(ctx)
app.accountKeeper.GetNextAccountNumber(ctx) //increment for future accs being started from right number
app.accountKeeper.SetAccount(ctx, acc)
app.stakingIndex.UpdateStake(types.AccNumber(acc.AccountNumber), acc.Coins.AmountOf(coin.CYB).Int64())
}
Expand Down
2 changes: 1 addition & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (app *CyberdApp) ExportAppStateAndValidators() (appState json.RawMessage, v
// iterate to get the accounts
var accounts []GenesisAccount
appendAccount := func(acc auth.Account) (stop bool) {
account := NewGenesisAccountI(acc)
account := NewGenesisAccount(acc)
accounts = append(accounts, account)
return false
}
Expand Down
28 changes: 12 additions & 16 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,25 @@ func NewGenesisState(
}

type GenesisAccount struct {
Address sdk.AccAddress `json:"addr"`
Amount int64 `json:"amt"`
Address sdk.AccAddress `json:"addr"`
Amount int64 `json:"amt"`
AccNumber uint64 `json:"nmb"`
}

func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount {
func NewGenesisAccount(acc auth.Account) GenesisAccount {
return GenesisAccount{
Address: acc.Address,
Amount: acc.Coins.AmountOf(coin.CYB).Int64(),
}
}

func NewGenesisAccountI(acc auth.Account) GenesisAccount {
return GenesisAccount{
Address: acc.GetAddress(),
Amount: acc.GetCoins().AmountOf(coin.CYB).Int64(),
Address: acc.GetAddress(),
Amount: acc.GetCoins().AmountOf(coin.CYB).Int64(),
AccNumber: acc.GetAccountNumber(),
}
}

// convert GenesisAccount to auth.BaseAccount
func (ga *GenesisAccount) ToAccount() (acc *auth.BaseAccount) {
return &auth.BaseAccount{
Address: ga.Address,
Coins: sdk.Coins{sdk.NewInt64Coin(coin.CYB, ga.Amount)},
Address: ga.Address,
Coins: sdk.Coins{sdk.NewInt64Coin(coin.CYB, ga.Amount)},
AccountNumber: ga.AccNumber,
}
}

Expand Down Expand Up @@ -111,7 +107,7 @@ func NewDefaultGenesisState() GenesisState {
},
SlashingData: slashing.DefaultGenesisState(),
DistrData: distr.DefaultGenesisState(),
GenTxs: nil,
GenTxs: []json.RawMessage{},
}
}

Expand Down Expand Up @@ -154,7 +150,7 @@ func CyberdAppGenState(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []
return genesisState, nil
}

// CyberdAppGenState but with JSON
//todo should be here?
func CyberdAppGenStateJSON(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (
appState json.RawMessage, err error) {
// create the final app state
Expand Down
128 changes: 0 additions & 128 deletions daemon/cmd/collect.go

This file was deleted.

28 changes: 0 additions & 28 deletions daemon/cmd/generate.go

This file was deleted.

80 changes: 0 additions & 80 deletions daemon/cmd/generate_accs.go

This file was deleted.

Loading