Switch to BurnFeeHandler

This commit is contained in:
Christopher Goes 2018-04-17 01:06:07 +02:00
parent 3bbb15f454
commit 474fa1dfd1
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
4 changed files with 11 additions and 10 deletions

View File

@ -73,7 +73,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp {
AddRoute("simplestake", simplestake.NewHandler(stakeKeeper))
// Define the feeHandler.
app.feeHandler = func(ctx sdk.Context, tx sdk.Tx, fees sdk.Coins) {}
app.feeHandler = auth.BurnFeeHandler
// Initialize BaseApp.
app.SetTxDecoder(app.txDecoder)

View File

@ -83,7 +83,7 @@ func NewDemocoinApp(logger log.Logger, db dbm.DB) *DemocoinApp {
AddRoute("simplestake", simplestake.NewHandler(stakeKeeper))
// Define the feeHandler.
app.feeHandler = func(ctx sdk.Context, tx sdk.Tx, fee sdk.Coins) {}
app.feeHandler = auth.BurnFeeHandler
// Initialize BaseApp.
app.SetTxDecoder(app.txDecoder)

View File

@ -157,3 +157,7 @@ func deductFees(acc sdk.Account, fee sdk.StdFee) (sdk.Account, sdk.Result) {
acc.SetCoins(newCoins)
return acc, sdk.Result{}
}
// BurnFeeHandler burns all fees (decreasing total supply)
func BurnFeeHandler(ctx sdk.Context, tx sdk.Tx, fee sdk.Coins) {
}

View File

@ -12,9 +12,6 @@ import (
wire "github.com/cosmos/cosmos-sdk/wire"
)
func nopFeeHandler(ctx sdk.Context, tx sdk.Tx, fee sdk.Coins) {
}
func newTestMsg(addrs ...sdk.Address) *sdk.TestMsg {
return sdk.NewTestMsg(addrs...)
}
@ -75,7 +72,7 @@ func TestAnteHandlerSigErrors(t *testing.T) {
cdc := wire.NewCodec()
RegisterBaseAccount(cdc)
mapper := NewAccountMapper(cdc, capKey, &BaseAccount{})
anteHandler := NewAnteHandler(mapper, nopFeeHandler)
anteHandler := NewAnteHandler(mapper, BurnFeeHandler)
ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil)
// keys and addresses
@ -116,7 +113,7 @@ func TestAnteHandlerSequences(t *testing.T) {
cdc := wire.NewCodec()
RegisterBaseAccount(cdc)
mapper := NewAccountMapper(cdc, capKey, &BaseAccount{})
anteHandler := NewAnteHandler(mapper, nopFeeHandler)
anteHandler := NewAnteHandler(mapper, BurnFeeHandler)
ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil)
// keys and addresses
@ -182,7 +179,7 @@ func TestAnteHandlerFees(t *testing.T) {
cdc := wire.NewCodec()
RegisterBaseAccount(cdc)
mapper := NewAccountMapper(cdc, capKey, &BaseAccount{})
anteHandler := NewAnteHandler(mapper, nopFeeHandler)
anteHandler := NewAnteHandler(mapper, BurnFeeHandler)
ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil)
// keys and addresses
@ -219,7 +216,7 @@ func TestAnteHandlerBadSignBytes(t *testing.T) {
cdc := wire.NewCodec()
RegisterBaseAccount(cdc)
mapper := NewAccountMapper(cdc, capKey, &BaseAccount{})
anteHandler := NewAnteHandler(mapper, nopFeeHandler)
anteHandler := NewAnteHandler(mapper, BurnFeeHandler)
ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil)
// keys and addresses
@ -294,7 +291,7 @@ func TestAnteHandlerSetPubKey(t *testing.T) {
cdc := wire.NewCodec()
RegisterBaseAccount(cdc)
mapper := NewAccountMapper(cdc, capKey, &BaseAccount{})
anteHandler := NewAnteHandler(mapper, nopFeeHandler)
anteHandler := NewAnteHandler(mapper, BurnFeeHandler)
ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil)
// keys and addresses