Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1981 from bandprotocol/chain-remove-gas-refund
Browse files Browse the repository at this point in the history
chain: Remove gas price refund for report transactions
  • Loading branch information
sorawit authored Jun 15, 2020
2 parents ae34419 + 8b70340 commit 6131dba
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Chain

- (impv) [\#1981](https://github.com/bandprotocol/bandchain/pull/1981) Remove gas price refund for report transactions.
- (feat) [\#1872](https://github.com/bandprotocol/bandchain/pull/1872) Add Owasm executor on Google Cloud function
- (feat) [\#1951](https://github.com/bandprotocol/bandchain/pull/1951) Add REST endpoint to get genesis file.
- (feat) [\#1908](https://github.com/bandprotocol/bandchain/pull/1908) Support google cloud function REST executor
Expand Down
36 changes: 0 additions & 36 deletions chain/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,42 +366,6 @@ func (app *BandApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) ab
return app.mm.BeginBlock(ctx, req)
}

// DeliverTx application updates every transction
func (app *BandApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) {
response := app.BaseApp.DeliverTx(req)

if response.IsOK() {
// Refund 100% of gas fee for any successful transaction that only contains MsgReportData
tx, err := app.TxDecoder(req.Tx)
if err != nil { // Should never happen because BaseApp.DeliverTx succeeds
panic(err)
}
isAllReportTxs := true
if stdTx, ok := tx.(auth.StdTx); ok {
for _, msg := range tx.GetMsgs() {
if _, ok := msg.(oracle.MsgReportData); !ok {
isAllReportTxs = false
break
}
}
if isAllReportTxs && !stdTx.Fee.Amount.IsZero() {
err := app.BankKeeper.SendCoinsFromModuleToAccount(
app.DeliverContext,
auth.FeeCollectorName,
stdTx.GetSigners()[0],
stdTx.Fee.Amount,
)
if err != nil { // Should never happen because we just return the collected fee
panic(err)
}

}
}
}

return response
}

// EndBlocker application updates every end block
func (app *BandApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
return app.mm.EndBlock(ctx, req)
Expand Down

0 comments on commit 6131dba

Please sign in to comment.