Skip to content

Commit

Permalink
change error to warn (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
xizho10 authored and laizy committed Jul 16, 2018
1 parent 8df3f7d commit 25d16ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions http/base/rest/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ func SendRawTransaction(cmd map[string]interface{}) map[string]interface{} {
if err := txn.Deserialize(bytes.NewReader(bys)); err != nil {
return ResponsePack(berr.INVALID_TRANSACTION)
}
var hash common.Uint256
hash = txn.Hash()
log.Debugf("SendRawTransaction recv %s", hash.ToHexString())
if txn.TxType == types.Invoke || txn.TxType == types.Deploy {
if preExec, ok := cmd["PreExec"].(string); ok && preExec == "1" {
resp["Result"], err = bactor.PreExecuteContract(&txn)
Expand All @@ -285,15 +288,15 @@ func SendRawTransaction(cmd map[string]interface{}) map[string]interface{} {
return resp
}
}
var hash common.Uint256
hash = txn.Hash()
log.Debugf("SendRawTransaction send to txpool %s", hash.ToHexString())
if errCode, desc := bcomn.SendTxToPool(&txn); errCode != ontErrors.ErrNoError {
resp["Error"] = int64(errCode)
resp["Result"] = desc
log.Warnf("SendRawTransaction verified %s error: %s", hash.ToHexString(), desc)
return resp
}
log.Debugf("SendRawTransaction verified %s", hash.ToHexString())
resp["Result"] = hash.ToHexString()

return resp
}

Expand Down
6 changes: 5 additions & 1 deletion http/base/rpc/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ func SendRawTransaction(params []interface{}) map[string]interface{} {
if err := txn.Deserialize(bytes.NewReader(hex)); err != nil {
return responsePack(berr.INVALID_TRANSACTION, "")
}
hash = txn.Hash()
log.Debugf("SendRawTransaction recv %s", hash.ToHexString())
if txn.TxType == types.Invoke || txn.TxType == types.Deploy {
if len(params) > 1 {
preExec, ok := params[1].(float64)
Expand All @@ -308,10 +310,12 @@ func SendRawTransaction(params []interface{}) map[string]interface{} {
}
}

hash = txn.Hash()
log.Debugf("SendRawTransaction send to txpool %s", hash.ToHexString())
if errCode, desc := bcomn.SendTxToPool(&txn); errCode != ontErrors.ErrNoError {
log.Warnf("SendRawTransaction verified %s error: %s", hash.ToHexString(), desc)
return responsePack(berr.INVALID_TRANSACTION, desc)
}
log.Debugf("SendRawTransaction verified %s", hash.ToHexString())
default:
return responsePack(berr.INVALID_PARAMS, "")
}
Expand Down

0 comments on commit 25d16ae

Please sign in to comment.