Commit c00775bd authored by 李伟@五瓣科技's avatar 李伟@五瓣科技

use send loop

parent 59adbdf7
......@@ -39,13 +39,6 @@ var rootCmd = &cobra.Command{
Use: "sendTxs",
Short: "send batch txs hash to chain and original txs to redis",
Run: func(cmd *cobra.Command, args []string) {
//go func() {
// if err := multisend.ProduceOriginalTx(); err != nil {
// panic(err)
// }
//}()
fmt.Printf("webStaticDir: %s \n", webStaticDir)
cfg := multisend.Config{
Rate: rate,
......
......@@ -517,10 +517,13 @@ func (web *WebServicer) TxsHandler(w http.ResponseWriter, r *http.Request) {
SetSendRecord(id, SendRecord{TotalConsTx: int64(consTxNum)})
go func() {
if err := web.ProduceTxs(params.From, params.ToAddrs, int(params.TxCount), params.EveryTxAmount, id, params.RequestAmount); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
if err := web.sendLoop(params.From, params.ToAddrs, int(params.TxCount), params.EveryTxAmount, id, params.RequestAmount); err != nil {
//if err := web.ProduceTxs(params.From, params.ToAddrs, int(params.TxCount), params.EveryTxAmount, id, params.RequestAmount); err != nil {
fmt.Printf("web send loop, id: %s err: %s \n", id, err.Error())
}
atomic.StoreInt32(&Running, 0)
}()
resAsJson, err := json.Marshal(id)
......
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