From dae32a3d65f100da2b65b466f6a043ca4730612a Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Thu, 13 Sep 2018 03:03:30 -0400 Subject: [PATCH] ... --- x/distribution/keeper/keeper.go | 17 ++++++++++++++--- x/distribution/keeper/key.go | 5 ++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 741e3aa9a..7cc2c1290 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -9,6 +9,7 @@ import ( // keeper of the stake store type Keeper struct { storeKey sdk.StoreKey + storeTKey sdk.StoreKey cdc *wire.Codec coinKeeper types.CoinKeeper stakeKeeper types.StakeKeeper @@ -17,11 +18,12 @@ type Keeper struct { codespace sdk.CodespaceType } -func NewKeeper(cdc *wire.Codec, key sdk.StoreKey, ck types.CoinKeeper, +func NewKeeper(cdc *wire.Codec, key, tkey sdk.StoreKey, ck types.CoinKeeper, sk types.StakeKeeper, codespace sdk.CodespaceType) Keeper { keeper := Keeper{ storeKey: key, + storeTKey: tkey, cdc: cdc, coinKeeper: ck, codespace: codespace, @@ -35,7 +37,7 @@ func NewKeeper(cdc *wire.Codec, key sdk.StoreKey, ck types.CoinKeeper, func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool) { store := ctx.KVStore(k.storeKey) - b := store.Get(GlobalKey) + b := store.Get(FeePoolKey) if b == nil { panic("Stored fee pool should not have been nil") } @@ -48,5 +50,14 @@ func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool) { func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) { store := ctx.KVStore(k.storeKey) b := k.cdc.MustMarshalBinary(feePool) - store.Set(GlobalKey, b) + store.Set(FeePoolKey, b) +} + +//______________________________________________________________________ + +// set the global fee pool distribution info +func (k Keeper) GetFeePool(ctx sdk.Context, proposerPK sdk.PubKey) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshalBinary(proposerPK) + store.Set(ProposerKey, b) } diff --git a/x/distribution/keeper/key.go b/x/distribution/keeper/key.go index f4cf1e0f9..2b09573ad 100644 --- a/x/distribution/keeper/key.go +++ b/x/distribution/keeper/key.go @@ -6,9 +6,12 @@ import ( // keys/key-prefixes var ( - GlobalKey = []byte{0x00} // key for global distribution state + FeePoolKey = []byte{0x00} // key for global distribution state ValidatorDistInfoKey = []byte{0x01} // prefix for each key to a validator distribution DelegatorDistInfoKey = []byte{0x02} // prefix for each key to a delegation distribution + + // transient + ProposerKey = []byte{0x00} // key for storing the proposer operator address ) // gets the key for the validator distribution info from address