Fix testcases by mounting store
This commit is contained in:
parent
95c5baf449
commit
67f7f31ba9
|
@ -87,8 +87,8 @@ func NewGaiaApp(logger log.Logger, db dbm.DB) *GaiaApp {
|
|||
app.SetInitChainer(app.initChainer)
|
||||
app.SetBeginBlocker(slashing.NewBeginBlocker(app.slashingKeeper))
|
||||
app.SetEndBlocker(stake.NewEndBlocker(app.stakeKeeper))
|
||||
app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyIBC, app.keyStake)
|
||||
app.SetAnteHandler(auth.NewAnteHandler(app.accountMapper, app.feeCollectionKeeper))
|
||||
app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyIBC, app.keyStake, app.keySlashing)
|
||||
err := app.LoadLatestVersion(app.keyMain)
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
|
|
|
@ -85,7 +85,7 @@ func (k Keeper) handleValidatorSignature(ctx sdk.Context, pubkey crypto.PubKey,
|
|||
}
|
||||
index := height % SignedBlocksWindow
|
||||
address := pubkey.Address()
|
||||
signInfo := k.getValidatorSigningInfo(ctx, address)
|
||||
signInfo, _ := k.getValidatorSigningInfo(ctx, address)
|
||||
previous := k.getValidatorSigningBitArray(ctx, address, index)
|
||||
if previous && !signed {
|
||||
k.setValidatorSigningBitArray(ctx, address, index, false)
|
||||
|
@ -106,10 +106,15 @@ func (k Keeper) handleValidatorSignature(ctx sdk.Context, pubkey crypto.PubKey,
|
|||
}
|
||||
}
|
||||
|
||||
func (k Keeper) getValidatorSigningInfo(ctx sdk.Context, address sdk.Address) (info validatorSigningInfo) {
|
||||
func (k Keeper) getValidatorSigningInfo(ctx sdk.Context, address sdk.Address) (info validatorSigningInfo, found bool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := store.Get(validatorSigningInfoKey(address))
|
||||
if bz == nil {
|
||||
found = false
|
||||
} else {
|
||||
k.cdc.MustUnmarshalBinary(bz, &info)
|
||||
found = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -122,7 +127,12 @@ func (k Keeper) setValidatorSigningInfo(ctx sdk.Context, address sdk.Address, in
|
|||
func (k Keeper) getValidatorSigningBitArray(ctx sdk.Context, address sdk.Address, index int64) (signed bool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := store.Get(validatorSigningBitArrayKey(address, index))
|
||||
if bz == nil {
|
||||
// lazy: treat empty key as unsigned
|
||||
signed = false
|
||||
} else {
|
||||
k.cdc.MustUnmarshalBinary(bz, &signed)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue