Skip to content

Commit a3e1d27

Browse files
authored
catch errors from txn construction for unlock stake and unstake txns (#701)
1 parent 7f1c8dd commit a3e1d27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

routes/stake.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ func (fes *APIServer) CreateUnstakeTxn(ww http.ResponseWriter, req *http.Request
334334
additionalOutputs,
335335
)
336336

337+
if err != nil {
338+
_AddBadRequestError(ww, fmt.Sprintf("CreateUnstakeTxn: Problem creating transaction: %v", err))
339+
return
340+
}
341+
337342
// Construct response.
338343
txnBytes, err := txn.ToBytes(true)
339344
if err != nil {
@@ -428,6 +433,10 @@ func (fes *APIServer) CreateUnlockStakeTxn(ww http.ResponseWriter, req *http.Req
428433
fes.backendServer.GetMempool(),
429434
additionalOutputs,
430435
)
436+
if err != nil {
437+
_AddBadRequestError(ww, fmt.Sprintf("CreateUnlockStakeTxn: Problem creating transaction: %v", err))
438+
return
439+
}
431440

432441
// Construct response.
433442
txnBytes, err := txn.ToBytes(true)

0 commit comments

Comments
 (0)