Commit 521b6f8d authored by duanjinfei's avatar duanjinfei

batch broadcastTx test

parent f1fb7079
...@@ -134,7 +134,6 @@ func (m *Sha3Request) GetData() []byte { ...@@ -134,7 +134,6 @@ func (m *Sha3Request) GetData() []byte {
} }
type Sha3Response struct { type Sha3Response struct {
//
Hash *github_com_CaduceusMetaverseProtocol_MetaTypes_types.Hash `protobuf:"bytes,1,opt,name=hash,proto3,customtype=github.com/CaduceusMetaverseProtocol/MetaTypes/types.Hash" json:"hash,omitempty"` Hash *github_com_CaduceusMetaverseProtocol_MetaTypes_types.Hash `protobuf:"bytes,1,opt,name=hash,proto3,customtype=github.com/CaduceusMetaverseProtocol/MetaTypes/types.Hash" json:"hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
......
...@@ -68,6 +68,82 @@ func (m *BroadcastEthTxWithFromRequest) GetFrom() string { ...@@ -68,6 +68,82 @@ func (m *BroadcastEthTxWithFromRequest) GetFrom() string {
return "" return ""
} }
type BroadcastEthTxWithFromRequests struct {
List []*BroadcastEthTxWithFromRequest `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BroadcastEthTxWithFromRequests) Reset() { *m = BroadcastEthTxWithFromRequests{} }
func (m *BroadcastEthTxWithFromRequests) String() string { return proto.CompactTextString(m) }
func (*BroadcastEthTxWithFromRequests) ProtoMessage() {}
func (*BroadcastEthTxWithFromRequests) Descriptor() ([]byte, []int) {
return fileDescriptor_2dc67120507b0009, []int{1}
}
func (m *BroadcastEthTxWithFromRequests) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BroadcastEthTxWithFromRequests.Unmarshal(m, b)
}
func (m *BroadcastEthTxWithFromRequests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BroadcastEthTxWithFromRequests.Marshal(b, m, deterministic)
}
func (m *BroadcastEthTxWithFromRequests) XXX_Merge(src proto.Message) {
xxx_messageInfo_BroadcastEthTxWithFromRequests.Merge(m, src)
}
func (m *BroadcastEthTxWithFromRequests) XXX_Size() int {
return xxx_messageInfo_BroadcastEthTxWithFromRequests.Size(m)
}
func (m *BroadcastEthTxWithFromRequests) XXX_DiscardUnknown() {
xxx_messageInfo_BroadcastEthTxWithFromRequests.DiscardUnknown(m)
}
var xxx_messageInfo_BroadcastEthTxWithFromRequests proto.InternalMessageInfo
func (m *BroadcastEthTxWithFromRequests) GetList() []*BroadcastEthTxWithFromRequest {
if m != nil {
return m.List
}
return nil
}
type ResponseBroadcastTxs struct {
List []*ResponseBroadcastTx `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ResponseBroadcastTxs) Reset() { *m = ResponseBroadcastTxs{} }
func (m *ResponseBroadcastTxs) String() string { return proto.CompactTextString(m) }
func (*ResponseBroadcastTxs) ProtoMessage() {}
func (*ResponseBroadcastTxs) Descriptor() ([]byte, []int) {
return fileDescriptor_2dc67120507b0009, []int{2}
}
func (m *ResponseBroadcastTxs) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResponseBroadcastTxs.Unmarshal(m, b)
}
func (m *ResponseBroadcastTxs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ResponseBroadcastTxs.Marshal(b, m, deterministic)
}
func (m *ResponseBroadcastTxs) XXX_Merge(src proto.Message) {
xxx_messageInfo_ResponseBroadcastTxs.Merge(m, src)
}
func (m *ResponseBroadcastTxs) XXX_Size() int {
return xxx_messageInfo_ResponseBroadcastTxs.Size(m)
}
func (m *ResponseBroadcastTxs) XXX_DiscardUnknown() {
xxx_messageInfo_ResponseBroadcastTxs.DiscardUnknown(m)
}
var xxx_messageInfo_ResponseBroadcastTxs proto.InternalMessageInfo
func (m *ResponseBroadcastTxs) GetList() []*ResponseBroadcastTx {
if m != nil {
return m.List
}
return nil
}
type RequestPing struct { type RequestPing struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -78,7 +154,7 @@ func (m *RequestPing) Reset() { *m = RequestPing{} } ...@@ -78,7 +154,7 @@ func (m *RequestPing) Reset() { *m = RequestPing{} }
func (m *RequestPing) String() string { return proto.CompactTextString(m) } func (m *RequestPing) String() string { return proto.CompactTextString(m) }
func (*RequestPing) ProtoMessage() {} func (*RequestPing) ProtoMessage() {}
func (*RequestPing) Descriptor() ([]byte, []int) { func (*RequestPing) Descriptor() ([]byte, []int) {
return fileDescriptor_2dc67120507b0009, []int{1} return fileDescriptor_2dc67120507b0009, []int{3}
} }
func (m *RequestPing) XXX_Unmarshal(b []byte) error { func (m *RequestPing) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RequestPing.Unmarshal(m, b) return xxx_messageInfo_RequestPing.Unmarshal(m, b)
...@@ -108,7 +184,7 @@ func (m *ResponsePing) Reset() { *m = ResponsePing{} } ...@@ -108,7 +184,7 @@ func (m *ResponsePing) Reset() { *m = ResponsePing{} }
func (m *ResponsePing) String() string { return proto.CompactTextString(m) } func (m *ResponsePing) String() string { return proto.CompactTextString(m) }
func (*ResponsePing) ProtoMessage() {} func (*ResponsePing) ProtoMessage() {}
func (*ResponsePing) Descriptor() ([]byte, []int) { func (*ResponsePing) Descriptor() ([]byte, []int) {
return fileDescriptor_2dc67120507b0009, []int{2} return fileDescriptor_2dc67120507b0009, []int{4}
} }
func (m *ResponsePing) XXX_Unmarshal(b []byte) error { func (m *ResponsePing) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResponsePing.Unmarshal(m, b) return xxx_messageInfo_ResponsePing.Unmarshal(m, b)
...@@ -139,7 +215,7 @@ func (m *RequestBroadcastTx) Reset() { *m = RequestBroadcastTx{} } ...@@ -139,7 +215,7 @@ func (m *RequestBroadcastTx) Reset() { *m = RequestBroadcastTx{} }
func (m *RequestBroadcastTx) String() string { return proto.CompactTextString(m) } func (m *RequestBroadcastTx) String() string { return proto.CompactTextString(m) }
func (*RequestBroadcastTx) ProtoMessage() {} func (*RequestBroadcastTx) ProtoMessage() {}
func (*RequestBroadcastTx) Descriptor() ([]byte, []int) { func (*RequestBroadcastTx) Descriptor() ([]byte, []int) {
return fileDescriptor_2dc67120507b0009, []int{3} return fileDescriptor_2dc67120507b0009, []int{5}
} }
func (m *RequestBroadcastTx) XXX_Unmarshal(b []byte) error { func (m *RequestBroadcastTx) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RequestBroadcastTx.Unmarshal(m, b) return xxx_messageInfo_RequestBroadcastTx.Unmarshal(m, b)
...@@ -177,7 +253,7 @@ func (m *ResponseBroadcastTx) Reset() { *m = ResponseBroadcastTx{} } ...@@ -177,7 +253,7 @@ func (m *ResponseBroadcastTx) Reset() { *m = ResponseBroadcastTx{} }
func (m *ResponseBroadcastTx) String() string { return proto.CompactTextString(m) } func (m *ResponseBroadcastTx) String() string { return proto.CompactTextString(m) }
func (*ResponseBroadcastTx) ProtoMessage() {} func (*ResponseBroadcastTx) ProtoMessage() {}
func (*ResponseBroadcastTx) Descriptor() ([]byte, []int) { func (*ResponseBroadcastTx) Descriptor() ([]byte, []int) {
return fileDescriptor_2dc67120507b0009, []int{4} return fileDescriptor_2dc67120507b0009, []int{6}
} }
func (m *ResponseBroadcastTx) XXX_Unmarshal(b []byte) error { func (m *ResponseBroadcastTx) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResponseBroadcastTx.Unmarshal(m, b) return xxx_messageInfo_ResponseBroadcastTx.Unmarshal(m, b)
...@@ -206,6 +282,8 @@ func (m *ResponseBroadcastTx) GetHash() []byte { ...@@ -206,6 +282,8 @@ func (m *ResponseBroadcastTx) GetHash() []byte {
func init() { func init() {
proto.RegisterType((*BroadcastEthTxWithFromRequest)(nil), "ring.v1.broadcastEthTxWithFromRequest") proto.RegisterType((*BroadcastEthTxWithFromRequest)(nil), "ring.v1.broadcastEthTxWithFromRequest")
proto.RegisterType((*BroadcastEthTxWithFromRequests)(nil), "ring.v1.broadcastEthTxWithFromRequests")
proto.RegisterType((*ResponseBroadcastTxs)(nil), "ring.v1.ResponseBroadcastTxs")
proto.RegisterType((*RequestPing)(nil), "ring.v1.RequestPing") proto.RegisterType((*RequestPing)(nil), "ring.v1.RequestPing")
proto.RegisterType((*ResponsePing)(nil), "ring.v1.ResponsePing") proto.RegisterType((*ResponsePing)(nil), "ring.v1.ResponsePing")
proto.RegisterType((*RequestBroadcastTx)(nil), "ring.v1.RequestBroadcastTx") proto.RegisterType((*RequestBroadcastTx)(nil), "ring.v1.RequestBroadcastTx")
...@@ -215,85 +293,88 @@ func init() { ...@@ -215,85 +293,88 @@ func init() {
func init() { proto.RegisterFile("ring/v1/service.proto", fileDescriptor_2dc67120507b0009) } func init() { proto.RegisterFile("ring/v1/service.proto", fileDescriptor_2dc67120507b0009) }
var fileDescriptor_2dc67120507b0009 = []byte{ var fileDescriptor_2dc67120507b0009 = []byte{
// 1270 bytes of a gzipped FileDescriptorProto // 1323 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xdd, 0x6e, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xdd, 0x6e, 0x1b, 0xc5,
0x14, 0xc6, 0x26, 0x6d, 0xda, 0x71, 0x9a, 0xc2, 0xb6, 0x49, 0x8d, 0x83, 0x93, 0x60, 0x10, 0x4a, 0x17, 0xff, 0xdb, 0x4d, 0x9b, 0x76, 0x9c, 0xa6, 0x7f, 0xb6, 0x4d, 0x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0xa3, 0x5a, 0x13, 0x0f, 0x26, 0x1e, 0x99,
0x23, 0x9f, 0x4e, 0x0e, 0xbb, 0x4d, 0xe1, 0x37, 0xc4, 0x1c, 0xff, 0x5b, 0xbc, 0x21, 0xd0, 0xc7, 0xf0, 0x43, 0x22, 0xf0, 0x94, 0x44, 0x9c, 0xe8, 0x9f, 0x7e, 0x35, 0x19, 0x31, 0x0f, 0x3e, 0xa1,
0x8f, 0x8f, 0x1b, 0x83, 0xeb, 0x91, 0xe7, 0xfe, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x4d, 0xc9, 0x7f, 0x91, 0x6a, 0x3e, 0xab, 0xa9, 0x7f, 0x0c, 0x3d, 0x91, 0x7f, 0xa7, 0xf5, 0xdf, 0x8a,
0xc5, 0xfa, 0xc9, 0x11, 0x00, 0x00, 0x97, 0xba, 0xaf, 0x5e, 0xfd, 0x51, 0x5c, 0xed, 0xca, 0x74, 0x47, 0xf5, 0x3f, 0x93, 0x4f, 0xc7,
0x47, 0xf5, 0xbf, 0x8a, 0x37, 0xd5, 0xa7, 0xe3, 0x83, 0x4e, 0x43, 0xfa, 0x0d, 0xb0, 0xc0, 0x7f,
0x17, 0xaf, 0xca, 0xe8, 0xe3, 0xc7, 0x47, 0xf5, 0xfe, 0x95, 0xd8, 0xf3, 0xd1, 0xbf, 0x01, 0x00,
0x00, 0xff, 0xff, 0xe6, 0x63, 0x18, 0x9d, 0xc9, 0x12, 0x00, 0x00,
} }
...@@ -24,7 +24,8 @@ const _ = grpc.SupportPackageIsVersion7 ...@@ -24,7 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type RingServiceClient interface { type RingServiceClient interface {
Ping(ctx context.Context, in *RequestPing, opts ...grpc.CallOption) (*ResponsePing, error) Ping(ctx context.Context, in *RequestPing, opts ...grpc.CallOption) (*ResponsePing, error)
//rpc BroadcastTx(RequestBroadcastTx) returns (ResponseBroadcastTx); // rpc BroadcastTx(RequestBroadcastTx) returns (ResponseBroadcastTx);
BroadcastTxs(ctx context.Context, in *BroadcastEthTxWithFromRequests, opts ...grpc.CallOption) (*ResponseBroadcastTxs, error)
BroadcastTx(ctx context.Context, in *BroadcastEthTxWithFromRequest, opts ...grpc.CallOption) (*ResponseBroadcastTx, error) BroadcastTx(ctx context.Context, in *BroadcastEthTxWithFromRequest, opts ...grpc.CallOption) (*ResponseBroadcastTx, error)
// web3 // web3
Sha3(ctx context.Context, in *Sha3Request, opts ...grpc.CallOption) (*Sha3Response, error) Sha3(ctx context.Context, in *Sha3Request, opts ...grpc.CallOption) (*Sha3Response, error)
...@@ -101,6 +102,15 @@ func (c *ringServiceClient) Ping(ctx context.Context, in *RequestPing, opts ...g ...@@ -101,6 +102,15 @@ func (c *ringServiceClient) Ping(ctx context.Context, in *RequestPing, opts ...g
return out, nil return out, nil
} }
func (c *ringServiceClient) BroadcastTxs(ctx context.Context, in *BroadcastEthTxWithFromRequests, opts ...grpc.CallOption) (*ResponseBroadcastTxs, error) {
out := new(ResponseBroadcastTxs)
err := c.cc.Invoke(ctx, "/ring.v1.RingService/BroadcastTxs", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) BroadcastTx(ctx context.Context, in *BroadcastEthTxWithFromRequest, opts ...grpc.CallOption) (*ResponseBroadcastTx, error) { func (c *ringServiceClient) BroadcastTx(ctx context.Context, in *BroadcastEthTxWithFromRequest, opts ...grpc.CallOption) (*ResponseBroadcastTx, error) {
out := new(ResponseBroadcastTx) out := new(ResponseBroadcastTx)
err := c.cc.Invoke(ctx, "/ring.v1.RingService/BroadcastTx", in, out, opts...) err := c.cc.Invoke(ctx, "/ring.v1.RingService/BroadcastTx", in, out, opts...)
...@@ -538,7 +548,8 @@ func (c *ringServiceClient) Logs(ctx context.Context, in *LogsRequest, opts ...g ...@@ -538,7 +548,8 @@ func (c *ringServiceClient) Logs(ctx context.Context, in *LogsRequest, opts ...g
// for forward compatibility // for forward compatibility
type RingServiceServer interface { type RingServiceServer interface {
Ping(context.Context, *RequestPing) (*ResponsePing, error) Ping(context.Context, *RequestPing) (*ResponsePing, error)
//rpc BroadcastTx(RequestBroadcastTx) returns (ResponseBroadcastTx); // rpc BroadcastTx(RequestBroadcastTx) returns (ResponseBroadcastTx);
BroadcastTxs(context.Context, *BroadcastEthTxWithFromRequests) (*ResponseBroadcastTxs, error)
BroadcastTx(context.Context, *BroadcastEthTxWithFromRequest) (*ResponseBroadcastTx, error) BroadcastTx(context.Context, *BroadcastEthTxWithFromRequest) (*ResponseBroadcastTx, error)
// web3 // web3
Sha3(context.Context, *Sha3Request) (*Sha3Response, error) Sha3(context.Context, *Sha3Request) (*Sha3Response, error)
...@@ -606,6 +617,9 @@ type UnimplementedRingServiceServer struct { ...@@ -606,6 +617,9 @@ type UnimplementedRingServiceServer struct {
func (UnimplementedRingServiceServer) Ping(context.Context, *RequestPing) (*ResponsePing, error) { func (UnimplementedRingServiceServer) Ping(context.Context, *RequestPing) (*ResponsePing, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
} }
func (UnimplementedRingServiceServer) BroadcastTxs(context.Context, *BroadcastEthTxWithFromRequests) (*ResponseBroadcastTxs, error) {
return nil, status.Errorf(codes.Unimplemented, "method BroadcastTxs not implemented")
}
func (UnimplementedRingServiceServer) BroadcastTx(context.Context, *BroadcastEthTxWithFromRequest) (*ResponseBroadcastTx, error) { func (UnimplementedRingServiceServer) BroadcastTx(context.Context, *BroadcastEthTxWithFromRequest) (*ResponseBroadcastTx, error) {
return nil, status.Errorf(codes.Unimplemented, "method BroadcastTx not implemented") return nil, status.Errorf(codes.Unimplemented, "method BroadcastTx not implemented")
} }
...@@ -781,6 +795,24 @@ func _RingService_Ping_Handler(srv interface{}, ctx context.Context, dec func(in ...@@ -781,6 +795,24 @@ func _RingService_Ping_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _RingService_BroadcastTxs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BroadcastEthTxWithFromRequests)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).BroadcastTxs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ring.v1.RingService/BroadcastTxs",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).BroadcastTxs(ctx, req.(*BroadcastEthTxWithFromRequests))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_BroadcastTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _RingService_BroadcastTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BroadcastEthTxWithFromRequest) in := new(BroadcastEthTxWithFromRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
...@@ -1656,6 +1688,10 @@ var RingService_ServiceDesc = grpc.ServiceDesc{ ...@@ -1656,6 +1688,10 @@ var RingService_ServiceDesc = grpc.ServiceDesc{
MethodName: "Ping", MethodName: "Ping",
Handler: _RingService_Ping_Handler, Handler: _RingService_Ping_Handler,
}, },
{
MethodName: "BroadcastTxs",
Handler: _RingService_BroadcastTxs_Handler,
},
{ {
MethodName: "BroadcastTx", MethodName: "BroadcastTx",
Handler: _RingService_BroadcastTx_Handler, Handler: _RingService_BroadcastTx_Handler,
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
) )
var ( var (
initAcc, initCmp, batchSign, batchRecover, batchRecoverTx, batchVerify bool initAcc, initCmp, broadcastTxArr bool
txCount, goRoutineCount, cmpAmount, batchCount int txCount, goRoutineCount, cmpAmount, batchCount, startCount, endCount int
cpuProfile string cpuProfile string
cfg *tool.Config cfg *tool.Config
) )
...@@ -20,12 +20,11 @@ func init() { ...@@ -20,12 +20,11 @@ func init() {
initCmd.PersistentFlags().BoolVar(&initAcc, "initAcc", false, "Start after initializing the account") initCmd.PersistentFlags().BoolVar(&initAcc, "initAcc", false, "Start after initializing the account")
initCmd.PersistentFlags().BoolVar(&initCmp, "initCmp", false, "Start after initializing the account cmp balance") initCmd.PersistentFlags().BoolVar(&initCmp, "initCmp", false, "Start after initializing the account cmp balance")
startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile") startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile")
startCmd.PersistentFlags().BoolVar(&batchSign, "batchSign", false, "test grpc interface -> batchSign") startCmd.PersistentFlags().IntVar(&startCount, "startCount", 0, "read excel start count")
startCmd.PersistentFlags().BoolVar(&batchRecover, "batchRecover", false, "test grpc interface -> batchRecover") startCmd.PersistentFlags().IntVar(&endCount, "endCount", 100, "read excel end count")
startCmd.PersistentFlags().BoolVar(&batchRecoverTx, "batchRecoverTx", false, "test grpc interface -> batchRecoverTx") startCmd.PersistentFlags().BoolVar(&broadcastTxArr, "broadcastTxArr", false, "test grpc interface -> broadcastTxArr")
startCmd.PersistentFlags().BoolVar(&batchVerify, "batchVerify", false, "test grpc interface -> batchVerify")
startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count") startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count")
startCmd.PersistentFlags().IntVar(&goRoutineCount, "goRoutineCount", 100, "send tran goRoutine count") startCmd.PersistentFlags().IntVar(&goRoutineCount, "goRoutineCount", 10, "send tran goRoutine count")
startCmd.PersistentFlags().IntVar(&batchCount, "batchCount", 100, "batch send tran count") startCmd.PersistentFlags().IntVar(&batchCount, "batchCount", 100, "batch send tran count")
startCmd.AddCommand(initCmd) startCmd.AddCommand(initCmd)
} }
......
...@@ -18,35 +18,17 @@ func init() { ...@@ -18,35 +18,17 @@ func init() {
return return
} }
cfg.StorageAccFileName += ".xlsx" cfg.StorageAccFileName += ".xlsx"
SendTxAccountArr = tool.ReadExcel(cfg.Count, cfg.StorageAccFileName)
} }
func startTest() { func startTest() {
SendTxAccountArr = tool.ReadExcelOfStartEnd(startCount, endCount, cfg.StorageAccFileName)
log.Infof("Program start initAccCount:%d tranCount", cfg.Count) log.Infof("Program start initAccCount:%d tranCount", cfg.Count)
cfg.GoRoutineCount = goRoutineCount cfg.GoRoutineCount = goRoutineCount
cfg.SignCount = txCount / 100 cfg.SignCount = txCount / 100
cfg.BatchCount = batchCount cfg.BatchCount = batchCount
arr, fromAddrArr := transaction.SignedTxArr(SendTxAccountArr, cfg) arr := transaction.SignedTxArr(SendTxAccountArr, cfg)
if batchSign { if broadcastTxArr {
if err := transaction.BatchSignHandler(arr, cfg); err != nil { if err := transaction.BroadcastTxArr(arr, cfg); err != nil {
log.Errorf("Bath Send Tran error: %s", err)
return
}
}
if batchRecover {
if err := transaction.BatchRecoverHandler(arr, cfg); err != nil {
log.Errorf("Bath Send Tran error: %s", err)
return
}
}
if batchRecoverTx {
if err := transaction.BatchRecoverTxHandler(arr, fromAddrArr, cfg); err != nil {
log.Errorf("Bath Send Tran error: %s", err)
return
}
}
if batchVerify {
if err := transaction.BatchVerifyHandler(arr, cfg); err != nil {
log.Errorf("Bath Send Tran error: %s", err) log.Errorf("Bath Send Tran error: %s", err)
return return
} }
......
...@@ -141,7 +141,7 @@ func ReadExcelOfStartEnd(start int, end int, fileName string) [][]string { ...@@ -141,7 +141,7 @@ func ReadExcelOfStartEnd(start int, end int, fileName string) [][]string {
return nil return nil
} }
res := make([][]string, 0) res := make([][]string, 0)
for i := start; i <= end; i++ { for i := start; i < end; i++ {
res = append(res, rows[i]) res = append(res, rows[i])
} }
return res return res
......
...@@ -6,10 +6,10 @@ import ( ...@@ -6,10 +6,10 @@ import (
"ChainGrpcTest/txcache" "ChainGrpcTest/txcache"
"context" "context"
v1 "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/base/v1" v1 "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/base/v1"
crypterv1 "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/crypter/v1" ring "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/ring/v1"
metatypes "github.com/CaduceusMetaverseProtocol/MetaTypes/types" metatypes "github.com/CaduceusMetaverseProtocol/MetaTypes/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
gogotypes "github.com/gogo/protobuf/types"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"sync/atomic" "sync/atomic"
...@@ -17,299 +17,103 @@ import ( ...@@ -17,299 +17,103 @@ import (
) )
var ( var (
batchSignRequest chan *crypterv1.BatchSignRequest
batchRecoverRequest chan *crypterv1.BatchRecoverRequest
batchRecoverTxRequest chan *crypterv1.BatchRecoverTxRequest
batchVerifyRequest chan *crypterv1.BatchVerifyRequest
bathHandleSendCount, allSignedTxCount, totalSendTime int64 bathHandleSendCount, allSignedTxCount, totalSendTime int64
set Set broadcastEthTxWithFromRequestsArr chan *ring.BroadcastEthTxWithFromRequests
) )
type Set struct {
txArr []*v1.MetaTxBase
}
func init() { func init() {
batchSignRequest = make(chan *crypterv1.BatchSignRequest, 1000000) broadcastEthTxWithFromRequestsArr = make(chan *ring.BroadcastEthTxWithFromRequests, 1000000)
batchRecoverRequest = make(chan *crypterv1.BatchRecoverRequest, 1000000)
batchRecoverTxRequest = make(chan *crypterv1.BatchRecoverTxRequest, 1000000)
batchVerifyRequest = make(chan *crypterv1.BatchVerifyRequest, 1000000)
set.txArr = make([]*v1.MetaTxBase, 0)
} }
// batchSign 发送的签名交易 func BroadcastTxArr(tranArr []*types.Transaction, cfg *tool.Config) error {
func batchSign(client crypterv1.CrypterServiceClient, sleepTime int) {
var beforeSendTxTime time.Time
for {
select {
case batchSign := <-batchSignRequest:
if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime))
}
sendTranStartTime := time.Now()
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1))
}
sign, err := client.BatchSign(context.Background(), batchSign, grpc.CallContentSubtype(""))
if err != nil {
log.Errorf("SendTranErr: %s", err)
sign, err = client.BatchSign(context.Background(), batchSign, grpc.CallContentSubtype(""))
if err != nil {
log.Errorf("Send tran twice err: %s", err)
continue
}
}
beforeSendTxTime = time.Now()
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())
}
}
}
// BatchSignHandler 处理批量发送的签名交易
func BatchSignHandler(tranArr []*types.Transaction, cfg *tool.Config) error {
client, err := grpc.Dial(cfg.RpcNode, grpc.WithTransportCredentials(insecure.NewCredentials())) client, err := grpc.Dial(cfg.RpcNode, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil { if err != nil {
log.Error("dial nebula failed", "err", err) return err
} }
ringServiceClient := ring.NewRingServiceClient(client)
for i := 0; i < cfg.GoRoutineCount; i++ { for i := 0; i < cfg.GoRoutineCount; i++ {
go batchSign(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime) go broadcastTx(ringServiceClient)
} }
allSignedTxCount = int64(len(tranArr)) allSignedTxCount = int64(len(tranArr))
startTime := time.Now() startTime := time.Now()
ethTxArr := make([]*ring.BroadcastEthTxWithFromRequest, 0)
for i := 0; i < int(allSignedTxCount); i++ { for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchSignRequest{} inner := constructionEthLegacyTx(tranArr[i])
batchSignRequest <- &req ethTxAsAny, err := gogotypes.MarshalAny(&inner)
}
for {
if bathHandleSendCount == allSignedTxCount {
log.Infof("Send tran count: %d", bathHandleSendCount)
log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds())
break
}
}
return nil
}
// BatchRecover 发送的签名交易
func batchRecover(client crypterv1.CrypterServiceClient, sleepTime int) {
var beforeSendTxTime time.Time
for {
select {
case batchRecover := <-batchRecoverRequest:
if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime))
}
sendTranStartTime := time.Now()
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1))
}
sign, err := client.BatchRecover(context.Background(), batchRecover, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("SendTranErr: %s", err) log.Error("gogo types.MarshalAny error:", err)
sign, err = client.BatchRecover(context.Background(), batchRecover, grpc.CallContentSubtype(""))
if err != nil {
log.Errorf("Send tran twice err: %s", err)
continue
}
}
beforeSendTxTime = time.Now()
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())
}
}
}
// BatchRecoverHandler 处理批量发送的签名交易
func BatchRecoverHandler(tranArr []*types.Transaction, cfg *tool.Config) error {
grpcClient, err := grpc.Dial(cfg.RpcNode, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Error("dial nebula failed", "err", err)
}
serviceClient := crypterv1.NewCrypterServiceClient(grpcClient)
for i := 0; i < cfg.GoRoutineCount; i++ {
go batchRecover(serviceClient, cfg.SleepTime)
}
allSignedTxCount = int64(len(tranArr))
startTime := time.Now()
for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchRecoverRequest{}
batchRecoverRequest <- &req
}
for {
if bathHandleSendCount == allSignedTxCount {
log.Infof("Send tran count: %d", bathHandleSendCount)
log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds())
break
}
}
return nil
}
// BatchVerify 发送的签名交易
func batchVerify(client crypterv1.CrypterServiceClient, sleepTime int) {
var beforeSendTxTime time.Time
for {
select {
case batchVerify := <-batchVerifyRequest:
if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime))
}
sendTranStartTime := time.Now()
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1))
} }
sign, err := client.BatchVerify(context.Background(), batchVerify, grpc.CallContentSubtype("")) fromAddr, b := txcache.GetFromAddr(tranArr[i].Hash().Hex())
if err != nil { if !b {
log.Errorf("SendTranErr: %s", err)
sign, err = client.BatchVerify(context.Background(), batchVerify, grpc.CallContentSubtype(""))
if err != nil {
log.Errorf("Send tran twice err: %s", err)
continue continue
} }
request := ring.BroadcastEthTxWithFromRequest{
From: fromAddr,
EthTx: &v1.EthTransaction{Tx: ethTxAsAny},
} }
beforeSendTxTime = time.Now() ethTxArr = append(ethTxArr, &request)
atomic.AddInt64(&bathHandleSendCount, 1) if len(ethTxArr) == cfg.BatchCount {
sinceTime := time.Since(sendTranStartTime).Milliseconds() requests := ring.BroadcastEthTxWithFromRequests{
atomic.AddInt64(&totalSendTime, sinceTime) List: ethTxArr,
log.Infof("Send transaction time: %d ms, sign: %s ", sinceTime, sign.String())
} }
broadcastEthTxWithFromRequestsArr <- &requests
ethTxArr = make([]*ring.BroadcastEthTxWithFromRequest, 0)
} }
}
// BatchVerifyHandler 处理批量发送的签名交易
func BatchVerifyHandler(tranArr []*types.Transaction, cfg *tool.Config) error {
client, err := grpc.Dial(cfg.RpcNode, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Error("dial nebula failed", "err", err)
}
for i := 0; i < cfg.GoRoutineCount; i++ {
go batchVerify(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime)
}
allSignedTxCount = int64(len(tranArr))
startTime := time.Now()
for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchVerifyRequest{}
batchVerifyRequest <- &req
} }
for { for {
if bathHandleSendCount == allSignedTxCount { if bathHandleSendCount == allSignedTxCount {
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())
log.Infof("Send tran total time: %d ms", totalSendTime)
break break
} }
} }
return nil return nil
} }
// batchRecoverTx 发送的签名交易 // BatchSendTran 处理批量发送的签名交易
func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) { func broadcastTx(client ring.RingServiceClient) error {
var beforeSendTxTime time.Time var beforeSendTxTime time.Time
for { for {
select { select {
case batchRecoverTx := <-batchRecoverTxRequest: case broadcastEthTxWithFromRequests := <-broadcastEthTxWithFromRequestsArr:
if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime))
}
sendTranStartTime := time.Now() sendTranStartTime := time.Now()
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 { if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1)) time.Sleep(time.Millisecond * time.Duration(1))
} }
sign, err := client.BatchRecoverTx(context.Background(), batchRecoverTx, grpc.CallContentSubtype("")) txs, err := client.BroadcastTxs(context.Background(), broadcastEthTxWithFromRequests, nil)
if err != nil {
log.Errorf("SendTranErr: %s", err)
sign, err = client.BatchRecoverTx(context.Background(), batchRecoverTx, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("Send tran twice err: %s", err) log.Error("BroadcastTxs Error:", err)
continue
}
} }
log.Info("BroadcastTxs Res:", txs)
beforeSendTxTime = time.Now() beforeSendTxTime = time.Now()
atomic.AddInt64(&bathHandleSendCount, int64(len(batchRecoverTx.RawTx))) atomic.AddInt64(&bathHandleSendCount, int64(len(broadcastEthTxWithFromRequests.List)))
sinceTime := time.Since(sendTranStartTime).Milliseconds() sinceTime := time.Since(sendTranStartTime).Milliseconds()
atomic.AddInt64(&totalSendTime, sinceTime) atomic.AddInt64(&totalSendTime, sinceTime)
for _, tx := range sign.GetRecoverdTx() { log.Infof("Send transaction time: %d ms ", sinceTime)
if !txcache.CompareAddress(tx.TxHash.Hex(), tx.From.Hex()) {
log.Error("tx.TxHash:", tx.TxHash.Hex(), "tx.From", tx.From.Hex())
}
}
log.Infof("Send transaction time: %d ms", sinceTime)
} }
} }
} }
// BatchRecoverTxHandler 处理批量发送的签名交易 func constructionEthLegacyTx(tran *types.Transaction) v1.EthLegacyTx {
func BatchRecoverTxHandler(tranArr []*types.Transaction, fromAddrArr []common.Address, cfg *tool.Config) error {
client, err := grpc.Dial(cfg.RpcNode, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Error("dial nebula failed", "err", err)
}
for i := 0; i < cfg.GoRoutineCount; i++ {
go batchRecoverTx(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime)
}
allSignedTxCount = int64(len(tranArr))
startTime := time.Now()
rawTxArr := make([]*v1.MetaTxBase, 0)
for i := 0; i < int(allSignedTxCount); i++ {
tran := tranArr[i]
rawTx := constructionRawTx(tran)
rawTxArr = append(rawTxArr, &rawTx)
if len(rawTxArr) == cfg.BatchCount {
req := crypterv1.BatchRecoverTxRequest{
RawTx: rawTxArr,
}
batchRecoverTxRequest <- &req
rawTxArr = make([]*v1.MetaTxBase, 0)
}
}
for {
if bathHandleSendCount == allSignedTxCount {
log.Infof("Send tran count: %d", bathHandleSendCount)
log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds())
break
}
}
return nil
}
func constructionRawTx(tran *types.Transaction) v1.MetaTxBase {
v, r, s := tran.RawSignatureValues() v, r, s := tran.RawSignatureValues()
toAddr := metatypes.BytesToAddress(tran.To().Bytes()) toAddr := metatypes.BytesToAddress(tran.To().Bytes())
hash := metatypes.HexToHash(tran.Hash().Hex())
nv := metatypes.NewBigInt(0) nv := metatypes.NewBigInt(0)
nv.Set(v) nv.Set(v)
nr := metatypes.NewBigInt(0) nr := metatypes.NewBigInt(0)
nr.Set(r) nr.Set(r)
ns := metatypes.NewBigInt(0) ns := metatypes.NewBigInt(0)
ns.Set(s) ns.Set(s)
rawTx := v1.MetaTxBase{ rawTx := v1.EthLegacyTx{
TxType: uint32(tran.Type()),
ChainId: metatypes.NewBigInt(tran.ChainId().Int64()),
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,
V: nv, V: nv,
R: nr, R: nr,
S: ns, S: ns,
TxHash: &hash,
} }
return rawTx return rawTx
} }
func (s *Set) contain(metaBase metatypes.Address) bool {
for _, tx := range s.txArr {
if tx.From.Equal(metaBase) {
return true
}
}
return false
}
...@@ -4,12 +4,17 @@ import ( ...@@ -4,12 +4,17 @@ import (
"ChainGrpcTest/log" "ChainGrpcTest/log"
"ChainGrpcTest/tool" "ChainGrpcTest/tool"
"ChainGrpcTest/txcache" "ChainGrpcTest/txcache"
"context"
"crypto/ecdsa" "crypto/ecdsa"
ring "github.com/CaduceusMetaverseProtocol/MetaProtocol/gen/proto/go/ring/v1"
metatypes "github.com/CaduceusMetaverseProtocol/MetaTypes/types"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"math/big" "math/big"
"sync" "sync/atomic"
"time" "time"
) )
...@@ -28,6 +33,12 @@ type Transactor struct { ...@@ -28,6 +33,12 @@ type Transactor struct {
receivedAddr common.Address receivedAddr common.Address
} }
var (
tran = make(chan *Transactor, 0)
tranArr = make([]*types.Transaction, 0)
batchSignCount int32
)
func newTransactor(cfg TranConfig) (*Transactor, error) { func newTransactor(cfg TranConfig) (*Transactor, error) {
signerKey, err := crypto.HexToECDSA(cfg.PrivateKey) signerKey, err := crypto.HexToECDSA(cfg.PrivateKey)
if err != nil { if err != nil {
...@@ -50,17 +61,29 @@ func newTransactor(cfg TranConfig) (*Transactor, error) { ...@@ -50,17 +61,29 @@ func newTransactor(cfg TranConfig) (*Transactor, error) {
return &res, nil return &res, nil
} }
var accountsNonceMap sync.Map
// SignedTxArr 获取全部签名数据 // SignedTxArr 获取全部签名数据
func SignedTxArr(sendTxAccountArr [][]string, cfg *tool.Config) ([]*types.Transaction, []common.Address) { func SignedTxArr(sendTxAccountArr [][]string, cfg *tool.Config) []*types.Transaction {
tranArr := make([]*types.Transaction, 0) for i := 0; i < cfg.GoRoutineCount; i++ {
fromAddrArr := make([]common.Address, 0) go signedTxFunc()
var signedTx *types.Transaction }
client, err := grpc.Dial(cfg.RpcNode, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Error("grpc dial error:", err)
return nil
}
defer client.Close()
serviceClient := ring.NewRingServiceClient(client)
for _, rows := range sendTxAccountArr { for _, rows := range sendTxAccountArr {
fromAddrArr = append(fromAddrArr, common.HexToAddress(rows[0]))
privateKey := rows[1] privateKey := rows[1]
nonce := big.NewInt(1) fromAddr := metatypes.HexToAddress(rows[0])
nonceReq := &ring.NonceRequest{
Address: &fromAddr,
}
response, err := serviceClient.Nonce(context.Background(), nonceReq, nil)
if err != nil {
return nil
}
nonce := new(big.Int).SetUint64(response.Nonce)
for signCount := 0; signCount < cfg.SignCount; signCount++ { for signCount := 0; signCount < cfg.SignCount; signCount++ {
tranCfg := TranConfig{ tranCfg := TranConfig{
Amount: cfg.Amount, Amount: cfg.Amount,
...@@ -71,21 +94,26 @@ func SignedTxArr(sendTxAccountArr [][]string, cfg *tool.Config) ([]*types.Transa ...@@ -71,21 +94,26 @@ func SignedTxArr(sendTxAccountArr [][]string, cfg *tool.Config) ([]*types.Transa
Nonce: nonce, Nonce: nonce,
} }
t, err := newTransactor(tranCfg) t, err := newTransactor(tranCfg)
signedTx, err = t.signedTx() if err != nil {
txcache.Add(signedTx.Hash().Hex(), rows[0])
nonce = big.NewInt(1).Add(nonce, big.NewInt(1))
if err != nil || signedTx == nil {
log.Errorf("signed tx error %s ", err) log.Errorf("signed tx error %s ", err)
continue continue
} }
tranArr = append(tranArr, signedTx) tran <- t
nonce = big.NewInt(1).Add(nonce, big.NewInt(1))
}
}
for {
if len(sendTxAccountArr)*cfg.SignCount == int(batchSignCount) {
return tranArr
} }
} }
return tranArr, fromAddrArr
} }
// signedTx 签名本币转账交易 // signedTxFunc 签名本币转账交易
func (t *Transactor) signedTx() (*types.Transaction, error) { func signedTxFunc() (*types.Transaction, error) {
for {
select {
case t := <-tran:
txData := types.LegacyTx{ txData := types.LegacyTx{
Nonce: t.config.Nonce.Uint64(), Nonce: t.config.Nonce.Uint64(),
To: &t.receivedAddr, To: &t.receivedAddr,
...@@ -101,5 +129,9 @@ func (t *Transactor) signedTx() (*types.Transaction, error) { ...@@ -101,5 +129,9 @@ func (t *Transactor) signedTx() (*types.Transaction, error) {
time.Sleep(time.Second) time.Sleep(time.Second)
return nil, err return nil, err
} }
return signedTx, nil txcache.Add(signedTx.Hash().Hex(), t.sender.Hex())
tranArr = append(tranArr, signedTx)
atomic.AddInt32(&batchSignCount, 1)
}
}
} }
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
) )
var ( var (
gtxcache = &TxCache{ gtxCache = &TxCache{
cache: make(map[string]string), cache: make(map[string]string),
} }
) )
...@@ -16,18 +16,25 @@ type TxCache struct { ...@@ -16,18 +16,25 @@ type TxCache struct {
mux sync.RWMutex mux sync.RWMutex
} }
func Add(txhash string, address string) { func Add(txHash string, address string) {
gtxcache.mux.Lock() gtxCache.mux.Lock()
defer gtxcache.mux.Unlock() defer gtxCache.mux.Unlock()
gtxcache.cache[txhash] = address gtxCache.cache[txHash] = address
} }
func CompareAddress(txhash string, newer string) bool { func CompareAddress(txHash string, newer string) bool {
gtxcache.mux.RLock() gtxCache.mux.RLock()
defer gtxcache.mux.RUnlock() defer gtxCache.mux.RUnlock()
o, exist := gtxcache.cache[txhash] o, exist := gtxCache.cache[txHash]
if !exist { if !exist {
return false return false
} }
return strings.Compare(newer, o) == 0 return strings.Compare(newer, o) == 0
} }
func GetFromAddr(txHash string) (string, bool) {
gtxCache.mux.RLock()
defer gtxCache.mux.RUnlock()
o, exist := gtxCache.cache[txHash]
return o, exist
}
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