Commit eeb84b49 authored by duanjinfei's avatar duanjinfei

add recovertx struct

parent 2d3ca6b9
...@@ -4,7 +4,9 @@ import ( ...@@ -4,7 +4,9 @@ import (
"ChainGrpcTest/log" "ChainGrpcTest/log"
"ChainGrpcTest/tool" "ChainGrpcTest/tool"
"context" "context"
v1 "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/base/v1"
crypterv1 "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/crypter/v1" crypterv1 "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/crypter/v1"
metatypes "github.com/CaduceusMetaverseProtocol/MetaTypes/types"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
...@@ -242,7 +244,26 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error ...@@ -242,7 +244,26 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error
allSignedTxCount = int64(len(tranArr)) allSignedTxCount = int64(len(tranArr))
startTime := time.Now() startTime := time.Now()
for i := 0; i < int(allSignedTxCount); i++ { for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchRecoverTxRequest{} tran := tranArr[i]
v, r, _ := tran.RawSignatureValues()
rawTxArr := make([]*v1.MetaTxBase, 0)
rawTx := v1.MetaTxBase{
TxType: uint32(tran.Type()),
ChainId: metatypes.NewBigInt(tran.ChainId().Int64()),
Nonce: tran.Nonce(),
GasPrice: metatypes.NewBigInt(tran.GasPrice().Int64()),
Gas: tran.Gas(),
To: nil,
Value: metatypes.NewBigInt(tran.Value().Int64()),
Data: tran.Data(),
AccessList: nil,
V: metatypes.NewBigInt(v.Int64()),
R: metatypes.NewBigInt(r.Int64()),
}
rawTxArr = append(rawTxArr, &rawTx)
req := crypterv1.BatchRecoverTxRequest{
RawTx: rawTxArr,
}
batchRecoverTxRequest <- &req batchRecoverTxRequest <- &req
} }
for { for {
......
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