Add RetCodeBadNonce and fix response formats

This commit is contained in:
Jae Kwon
2016-01-12 14:04:24 -08:00
parent 87b9866d1f
commit 44f22e351b
8 changed files with 22 additions and 18 deletions

View File

@ -38,7 +38,7 @@ func (app *CounterApplication) AppendTx(tx []byte) ([]types.Event, types.RetCode
copy(tx8, tx)
txValue := binary.LittleEndian.Uint64(tx8)
if txValue != uint64(app.txCount) {
return nil, types.RetCodeInternalError
return nil, types.RetCodeBadNonce
}
}
app.txCount += 1
@ -51,7 +51,7 @@ func (app *CounterApplication) CheckTx(tx []byte) types.RetCode {
copy(tx8, tx)
txValue := binary.LittleEndian.Uint64(tx8)
if txValue < uint64(app.txCount) {
return types.RetCodeInternalError
return types.RetCodeBadNonce
}
}
return 0