Commit 1b69df3c authored by kingwang's avatar kingwang Committed by vipwzw

all transaction can be send

parent ced3ff40
package para package para
import ( import (
"bytes"
"context" "context"
"sync/atomic" "sync/atomic"
"time" "time"
...@@ -52,19 +51,17 @@ func (mem *Mempool) SetQueueClient(client queue.Client) { ...@@ -52,19 +51,17 @@ func (mem *Mempool) SetQueueClient(client queue.Client) {
switch msg.Ty { switch msg.Ty {
case types.EventTx: case types.EventTx:
mlog.Info("Receive msg from para mempool") mlog.Info("Receive msg from para mempool")
if bytes.HasPrefix(msg.GetData().(*types.Transaction).Execer, types.ParaKey) { tx := msg.GetData().(*types.Transaction)
tx := msg.GetData().(*types.Transaction) for i := 0; i < retry_times; i++ {
for i := 0; i < retry_times; i++ { reply, err := mem.mainGrpcCli.SendTransaction(context.Background(), tx)
reply, err := mem.mainGrpcCli.SendTransaction(context.Background(), tx) if err == nil {
if err == nil { msg.Reply(client.NewMessage(mem.key, types.EventReply, &types.Reply{IsOk: true, Msg: reply.GetMsg()}))
msg.Reply(client.NewMessage(mem.key, types.EventReply, &types.Reply{IsOk: true, Msg: reply.GetMsg()})) break
break } else if err != nil && i != retry_times-1 {
} else if err != nil && i != retry_times-1 { time.Sleep(time.Millisecond * 10)
time.Sleep(time.Millisecond * 10) continue
continue } else {
} else { msg.Reply(client.NewMessage(mem.key, types.EventReply, err))
msg.Reply(client.NewMessage(mem.key, types.EventReply, err))
}
} }
} }
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment