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