mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-26 19:21:44 +00:00
Conform to protobuf TMSP
This commit is contained in:
@ -101,16 +101,15 @@ func (mem *Mempool) CheckTx(tx types.Tx) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TMSP callback function
|
// TMSP callback function
|
||||||
func (mem *Mempool) resCb(req tmsp.Request, res tmsp.Response) {
|
func (mem *Mempool) resCb(req *tmsp.Request, res *tmsp.Response) {
|
||||||
switch res := res.(type) {
|
switch res.Type {
|
||||||
case tmsp.ResponseCheckTx:
|
case tmsp.ResponseTypeCheckTx:
|
||||||
reqCheckTx := req.(tmsp.RequestCheckTx)
|
if tmsp.RetCode(res.Code) == tmsp.RetCodeOK {
|
||||||
if res.Code == tmsp.RetCodeOK {
|
|
||||||
mem.counter++
|
mem.counter++
|
||||||
memTx := &mempoolTx{
|
memTx := &mempoolTx{
|
||||||
counter: mem.counter,
|
counter: mem.counter,
|
||||||
height: int64(mem.height),
|
height: int64(mem.height),
|
||||||
tx: reqCheckTx.TxBytes,
|
tx: req.Data,
|
||||||
}
|
}
|
||||||
mem.txs.PushBack(memTx)
|
mem.txs.PushBack(memTx)
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,8 +32,8 @@ func (app *localAppConn) Error() error {
|
|||||||
|
|
||||||
func (app *localAppConn) EchoAsync(msg string) {
|
func (app *localAppConn) EchoAsync(msg string) {
|
||||||
app.Callback(
|
app.Callback(
|
||||||
tmsp.RequestEcho{msg},
|
tmsp.RequestEcho(msg),
|
||||||
tmsp.ResponseEcho{msg},
|
tmsp.ResponseEcho(msg),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ func (app *localAppConn) SetOptionAsync(key string, value string) {
|
|||||||
log := app.Application.SetOption(key, value)
|
log := app.Application.SetOption(key, value)
|
||||||
app.mtx.Unlock()
|
app.mtx.Unlock()
|
||||||
app.Callback(
|
app.Callback(
|
||||||
tmsp.RequestSetOption{key, value},
|
tmsp.RequestSetOption(key, value),
|
||||||
tmsp.ResponseSetOption{log},
|
tmsp.ResponseSetOption(log),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ func (app *localAppConn) AppendTxAsync(tx []byte) {
|
|||||||
code, result, log := app.Application.AppendTx(tx)
|
code, result, log := app.Application.AppendTx(tx)
|
||||||
app.mtx.Unlock()
|
app.mtx.Unlock()
|
||||||
app.Callback(
|
app.Callback(
|
||||||
tmsp.RequestAppendTx{tx},
|
tmsp.RequestAppendTx(tx),
|
||||||
tmsp.ResponseAppendTx{code, result, log},
|
tmsp.ResponseAppendTx(code, result, log),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ func (app *localAppConn) CheckTxAsync(tx []byte) {
|
|||||||
code, result, log := app.Application.CheckTx(tx)
|
code, result, log := app.Application.CheckTx(tx)
|
||||||
app.mtx.Unlock()
|
app.mtx.Unlock()
|
||||||
app.Callback(
|
app.Callback(
|
||||||
tmsp.RequestCheckTx{tx},
|
tmsp.RequestCheckTx(tx),
|
||||||
tmsp.ResponseCheckTx{code, result, log},
|
tmsp.ResponseCheckTx(code, result, log),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ func (app *localAppConn) GetHashAsync() {
|
|||||||
hash, log := app.Application.GetHash()
|
hash, log := app.Application.GetHash()
|
||||||
app.mtx.Unlock()
|
app.mtx.Unlock()
|
||||||
app.Callback(
|
app.Callback(
|
||||||
tmsp.RequestGetHash{},
|
tmsp.RequestGetHash(),
|
||||||
tmsp.ResponseGetHash{hash, log},
|
tmsp.ResponseGetHash(hash, log),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ func (s *State) execBlockOnProxyApp(evsw *events.EventSwitch, proxyAppConn proxy
|
|||||||
var validTxs, invalidTxs = 0, 0
|
var validTxs, invalidTxs = 0, 0
|
||||||
|
|
||||||
// Execute transactions and get hash
|
// Execute transactions and get hash
|
||||||
proxyCb := func(req tmsp.Request, res tmsp.Response) {
|
proxyCb := func(req *tmsp.Request, res *tmsp.Response) {
|
||||||
switch res := res.(type) {
|
switch res.Type {
|
||||||
case tmsp.ResponseAppendTx:
|
case tmsp.ResponseTypeAppendTx:
|
||||||
// TODO: make use of res.Log
|
// TODO: make use of res.Log
|
||||||
// TODO: make use of this info
|
// TODO: make use of this info
|
||||||
// Blocks may include invalid txs.
|
// Blocks may include invalid txs.
|
||||||
// reqAppendTx := req.(tmsp.RequestAppendTx)
|
// reqAppendTx := req.(tmsp.RequestAppendTx)
|
||||||
if res.Code == tmsp.RetCodeOK {
|
if tmsp.RetCode(res.Code) == tmsp.RetCodeOK {
|
||||||
validTxs += 1
|
validTxs += 1
|
||||||
} else {
|
} else {
|
||||||
log.Debug("Invalid tx", "code", res.Code, "log", res.Log)
|
log.Debug("Invalid tx", "code", res.Code, "log", res.Log)
|
||||||
|
Reference in New Issue
Block a user