init genesis WIP, also making golint compliant

This commit is contained in:
rigelrozanski
2018-02-08 10:36:13 +00:00
parent 9c00dda4eb
commit 40fd4589c1
6 changed files with 52 additions and 19 deletions
+5 -2
View File
@@ -13,11 +13,12 @@ import (
const appName = "BasecoinApp"
// BasecoinApp - extended ABCI application
type BasecoinApp struct {
*bam.BaseApp
router bam.Router
cdc *wire.Codec
multiStore sdk.CommitMultiStore
multiStore sdk.CommitMultiStore //TODO distinguish this store from *bam.BaseApp.cms <- is this one master?? confused
// The key to access the substores.
capKeyMainStore *sdk.KVStoreKey
@@ -27,6 +28,7 @@ type BasecoinApp struct {
accountMapper sdk.AccountMapper
}
// NewBasecoinApp - create new BasecoinApp
// TODO: This should take in more configuration options.
func NewBasecoinApp() *BasecoinApp {
@@ -46,6 +48,7 @@ func NewBasecoinApp() *BasecoinApp {
return app
}
// RunForever - BasecoinApp execution and cleanup
func (app *BasecoinApp) RunForever() {
// Start the ABCI server
@@ -64,7 +67,7 @@ func (app *BasecoinApp) RunForever() {
}
// Load the stores.
// Load the stores
func (app *BasecoinApp) loadStores() {
if err := app.LoadLatestVersion(app.capKeyMainStore); err != nil {
fmt.Println(err)
+10
View File
@@ -11,6 +11,7 @@ func (app *BasecoinApp) initBaseApp() {
app.BaseApp = bapp
app.router = bapp.Router()
app.initBaseAppTxDecoder()
app.initBaseAppInitStater()
}
func (app *BasecoinApp) initBaseAppTxDecoder() {
@@ -26,3 +27,12 @@ func (app *BasecoinApp) initBaseAppTxDecoder() {
return tx, nil
})
}
// used to define the custom logic for initialization
func (app *BasecoinApp) initBaseAppInitStater() {
accountMapper := app.accountMapper
app.BaseApp.SetInitStater(func(ctx sdk.Context, stateJSON []byte) sdk.Error {
// TODO: parse JSON
//accountMapper.SetAccount(ctx, ...)
})
}