Ejemplo n.º 1
0
func (cli *TMSPClient) CheckTxSync(tx []byte) (code types.CodeType, result []byte, log string, err error) {
	reqres := cli.queueRequest(types.RequestCheckTx(tx))
	cli.FlushSync()
	if cli.err != nil {
		return types.CodeType_InternalError, nil, "", cli.err
	}
	res := reqres.Response
	return res.Code, res.Data, res.Log, nil
}
Ejemplo n.º 2
0
func (app *localAppConn) CheckTxAsync(tx []byte) *tmspcli.ReqRes {
	app.mtx.Lock()
	code, result, log := app.Application.CheckTx(tx)
	app.mtx.Unlock()
	app.Callback(
		tmsp.RequestCheckTx(tx),
		tmsp.ResponseCheckTx(code, result, log),
	)
	return nil // TODO maybe create a ReqRes
}
Ejemplo n.º 3
0
// Validate a tx
func cmdCheckTx(c *cli.Context) {
	args := c.Args()
	if len(args) != 1 {
		fmt.Println("check_tx takes 1 argument")
		return
	}
	txString := args[0]
	tx := []byte(txString)
	if len(txString) > 2 && strings.HasPrefix(txString, "0x") {
		var err error
		tx, err = hex.DecodeString(txString[2:])
		if err != nil {
			fmt.Println(err.Error())
			return
		}
	}

	res, err := makeRequest(conn, types.RequestCheckTx(tx))
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	printResponse(res, string(res.Data))
}
Ejemplo n.º 4
0
func (cli *TMSPClient) CheckTxAsync(tx []byte) *ReqRes {
	return cli.queueRequest(types.RequestCheckTx(tx))
}