Skip to content

Commit

Permalink
test(e2e): fix e2e quorum sign mock
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Jul 22, 2024
1 parent 495831a commit cb41fa0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 0 additions & 4 deletions privval/signer_requestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ func DefaultValidationRequestHandler(

var proTxHash crypto.ProTxHash
proTxHash, err = privVal.GetProTxHash(context.Background())
if err != nil {
return res, err
}

if err != nil {
res = mustWrapMsg(&privvalproto.ProTxHashResponse{
ProTxHash: nil, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func setupCoreServer(cfg *Config) (*mockcoreserver.JRPCServer, error) {
srv = mockcoreserver.WithMethods(
srv,
mockcoreserver.WithQuorumInfoMethod(coreServer, mockcoreserver.Endless),
mockcoreserver.WithQuorumSignMethod(coreServer, mockcoreserver.Endless),
mockcoreserver.WithQuorumSignMethod(coreServer, mockcoreserver.Endless, coreServer.LLMQType),
mockcoreserver.WithQuorumVerifyMethod(coreServer, mockcoreserver.Endless),
mockcoreserver.WithMasternodeMethod(coreServer, mockcoreserver.Endless),
mockcoreserver.WithGetNetworkInfoMethod(coreServer, mockcoreserver.Endless),
Expand Down
12 changes: 7 additions & 5 deletions test/e2e/pkg/mockcoreserver/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ func WithQuorumInfoMethod(cs CoreServer, times int) MethodFunc {
}

// WithQuorumSignMethod ...
func WithQuorumSignMethod(cs CoreServer, times int) MethodFunc {
func WithQuorumSignMethod(cs CoreServer, times int, quorumType btcjson.LLMQType) MethodFunc {
call := OnMethod(func(ctx context.Context, req btcjson.Request) (interface{}, error) {
cmd := btcjson.QuorumCmd{}
err := unmarshalCmd(req, &cmd.SubCmd, &cmd.LLMQType, &cmd.RequestID, &cmd.MessageHash, &cmd.QuorumHash, &cmd.Submit)
err := unmarshalCmd(req, &cmd.SubCmd, &cmd.RequestID, &cmd.MessageHash, &cmd.QuorumHash, &cmd.Submit)
if err != nil {
return nil, err
}
cmd.LLMQType = &quorumType

return cs.QuorumSign(ctx, cmd), nil
})
return func(srv *JRPCServer) {
srv.
On("quorum sign").
On("quorum platformsign").
Expect(And(Debug())).
Times(times).
Respond(call, JSONContentType())
Expand Down Expand Up @@ -100,7 +102,7 @@ func WithMasternodeMethod(cs CoreServer, times int) MethodFunc {

// WithGetNetworkInfoMethod ...
func WithGetNetworkInfoMethod(cs CoreServer, times int) MethodFunc {
call := OnMethod(func(ctx context.Context, req btcjson.Request) (interface{}, error) {
call := OnMethod(func(ctx context.Context, _req btcjson.Request) (interface{}, error) {
cmd := btcjson.GetNetworkInfoCmd{}
return cs.GetNetworkInfo(ctx, cmd), nil
})
Expand All @@ -115,7 +117,7 @@ func WithGetNetworkInfoMethod(cs CoreServer, times int) MethodFunc {

// WithPingMethod ...
func WithPingMethod(cs CoreServer, times int) MethodFunc {
call := OnMethod(func(ctx context.Context, req btcjson.Request) (interface{}, error) {
call := OnMethod(func(ctx context.Context, _req btcjson.Request) (interface{}, error) {
cmd := btcjson.PingCmd{}
return cs.Ping(ctx, cmd), nil
})
Expand Down

0 comments on commit cb41fa0

Please sign in to comment.