Skip to content

Commit

Permalink
refactor: reduce repetition in process proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
ninabarbakadze committed Oct 10, 2024
1 parent 54b2b4d commit a873099
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/process_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp
}

sdkTx, err := app.txConfig.TxDecoder()(tx)
// Set the tx bytes in the context for app version v3 and greater
if sdkCtx.BlockHeader().Version.App >= 3 {
sdkCtx = sdkCtx.WithTxBytes(tx)
}

if err != nil {
if req.Header.Version.App == v1 {
// For appVersion 1, there was no block validity rule that all
Expand All @@ -90,9 +95,6 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp
return reject()
}

// Set the tx size on the context before calling the AnteHandler
sdkCtx = sdkCtx.WithTxBytes(tx)

// we need to increment the sequence for every transaction so that
// the signature check below is accurate. this error only gets hit
// if the account in question doesn't exist.
Expand All @@ -118,11 +120,6 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp
return reject()
}

// set the tx bytes in the context for app version v3 and greater
if sdkCtx.BlockHeader().Version.App >= 3 {
sdkCtx = sdkCtx.WithTxBytes(tx)
}

// validated the PFB signature
sdkCtx, err = handler(sdkCtx, sdkTx, false)
if err != nil {
Expand Down

0 comments on commit a873099

Please sign in to comment.