Commit a5410c05 authored by duanjinfei's avatar duanjinfei

change batch recovertx struct and log print

parent fcbafb8d
......@@ -227,7 +227,13 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) {
atomic.AddInt64(&bathHandleSendCount, 1)
sinceTime := time.Since(sendTranStartTime).Milliseconds()
atomic.AddInt64(&totalSendTime, sinceTime)
log.Infof("Send transaction time: %d ms, sign: %s ", sinceTime, sign.String())
for i, tx := range sign.GetRecoverdTx() {
rawTx := batchRecoverTx.RawTx
if tx.From.Hex() != rawTx[i].From.Hex() {
log.Error(" tx.From.Hex():", tx.From.Hex(), "rawTx[i].From.Hex():", rawTx[i].From.Hex())
}
}
log.Infof("Send transaction time: %d ms, sign: %s ", sinceTime)
}
}
}
......@@ -243,11 +249,11 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error
}
allSignedTxCount = int64(len(tranArr))
startTime := time.Now()
rawTxArr := make([]*v1.MetaTxBase, 0)
for i := 0; i < int(allSignedTxCount); i++ {
tran := tranArr[i]
v, r, s := tran.RawSignatureValues()
rawTxArr := make([]*v1.MetaTxBase, 0)
toaddr := metatypes.BytesToAddress(tran.To().Bytes())
toAddr := metatypes.BytesToAddress(tran.To().Bytes())
hash := metatypes.HexToHash(tran.Hash().Hex())
nv := metatypes.NewBigInt(0)
nv.Set(v)
......@@ -261,7 +267,7 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error
Nonce: tran.Nonce(),
GasPrice: metatypes.NewBigInt(tran.GasPrice().Int64()),
Gas: tran.Gas(),
To: &toaddr,
To: &toAddr,
Value: metatypes.NewBigInt(tran.Value().Int64()),
Data: tran.Data(),
AccessList: nil,
......@@ -274,10 +280,13 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error
req := crypterv1.BatchRecoverTxRequest{
RawTx: rawTxArr,
}
if len(rawTxArr) == cfg.SignCount {
batchRecoverTxRequest <- &req
rawTxArr = make([]*v1.MetaTxBase, 0)
}
}
for {
if bathHandleSendCount == allSignedTxCount {
if bathHandleSendCount == allSignedTxCount/int64(cfg.SignCount) {
log.Infof("Send tran count: %d", bathHandleSendCount)
log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds())
break
......
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