Skip to content

Commit

Permalink
catch errors from txn construction for unlock stake and unstake txns (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lazynina authored Nov 10, 2024
1 parent 7f1c8dd commit a3e1d27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions routes/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ func (fes *APIServer) CreateUnstakeTxn(ww http.ResponseWriter, req *http.Request
additionalOutputs,
)

if err != nil {
_AddBadRequestError(ww, fmt.Sprintf("CreateUnstakeTxn: Problem creating transaction: %v", err))
return
}

// Construct response.
txnBytes, err := txn.ToBytes(true)
if err != nil {
Expand Down Expand Up @@ -428,6 +433,10 @@ func (fes *APIServer) CreateUnlockStakeTxn(ww http.ResponseWriter, req *http.Req
fes.backendServer.GetMempool(),
additionalOutputs,
)
if err != nil {
_AddBadRequestError(ww, fmt.Sprintf("CreateUnlockStakeTxn: Problem creating transaction: %v", err))
return
}

// Construct response.
txnBytes, err := txn.ToBytes(true)
Expand Down

0 comments on commit a3e1d27

Please sign in to comment.