mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-04 02:52:07 +00:00
Add RetCodeBadNonce and fix response formats
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -32,7 +32,7 @@ CounterApp.prototype.append_tx = function(txBytes){
|
||||
r = new msg.buffer(txByteArray)
|
||||
txValue = wire.decode_big_endian(r, txBytes.length)
|
||||
if (txValue != this.txCount){
|
||||
return {"ret_code":1}
|
||||
return {"ret_code":6}
|
||||
}
|
||||
}
|
||||
this.txCount += 1;
|
||||
@@ -48,7 +48,7 @@ CounterApp.prototype.check_tx = function(txBytes){
|
||||
r = new msg.buffer(txByteArray)
|
||||
txValue = wire.decode_big_endian(r, txBytes.length)
|
||||
if (txValue < this.txCount){
|
||||
return {"ret_code":1}
|
||||
return {"ret_code":6}
|
||||
}
|
||||
}
|
||||
return {"ret_code":0}
|
||||
|
||||
@@ -31,7 +31,7 @@ class CounterApplication():
|
||||
txValue = decode_big_endian(
|
||||
BytesBuffer(txByteArray), len(txBytes))
|
||||
if txValue != self.txCount:
|
||||
return None, 1
|
||||
return None, 6
|
||||
self.txCount += 1
|
||||
return None, 0
|
||||
|
||||
@@ -43,7 +43,7 @@ class CounterApplication():
|
||||
txValue = decode_big_endian(
|
||||
BytesBuffer(txByteArray), len(txBytes))
|
||||
if txValue < self.txCount:
|
||||
return 1
|
||||
return 6
|
||||
return 0
|
||||
|
||||
def get_hash(self):
|
||||
|
||||
@@ -31,7 +31,7 @@ class CounterApplication():
|
||||
txValue = decode_big_endian(
|
||||
BytesBuffer(txByteArray), len(txBytes))
|
||||
if txValue != self.txCount:
|
||||
return None, 1
|
||||
return None, 6
|
||||
self.txCount += 1
|
||||
return None, 0
|
||||
|
||||
@@ -43,7 +43,7 @@ class CounterApplication():
|
||||
txValue = decode_big_endian(
|
||||
BytesBuffer(txByteArray), len(txBytes))
|
||||
if txValue < self.txCount:
|
||||
return 1
|
||||
return 6
|
||||
return 0
|
||||
|
||||
def get_hash(self):
|
||||
|
||||
Reference in New Issue
Block a user