|
1 | 1 | package components |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "fmt" |
4 | 5 | "testing" |
5 | 6 |
|
6 | 7 | "github.com/multiversx/mx-chain-core-go/core" |
| 8 | + "github.com/stretchr/testify/require" |
| 9 | + |
7 | 10 | "github.com/multiversx/mx-chain-go/config" |
8 | 11 | "github.com/multiversx/mx-chain-go/testscommon" |
9 | 12 | "github.com/multiversx/mx-chain-go/testscommon/factory" |
10 | | - "github.com/stretchr/testify/require" |
11 | 13 | ) |
12 | 14 |
|
13 | 15 | func createArgsCryptoComponentsHolder() ArgsCryptoComponentsHolder { |
@@ -48,6 +50,7 @@ func createArgsCryptoComponentsHolder() ArgsCryptoComponentsHolder { |
48 | 50 | }, |
49 | 51 | AllValidatorKeysPemFileName: "allValidatorKeys.pem", |
50 | 52 | BypassTxSignatureCheck: true, |
| 53 | + BypassBlockSignatureCheck: false, |
51 | 54 | } |
52 | 55 | } |
53 | 56 |
|
@@ -76,6 +79,19 @@ func TestCreateCryptoComponents(t *testing.T) { |
76 | 79 | require.Nil(t, comp.Create()) |
77 | 80 | require.Nil(t, comp.Close()) |
78 | 81 | }) |
| 82 | + t.Run("should work with bypass blocks sig check", func(t *testing.T) { |
| 83 | + t.Parallel() |
| 84 | + |
| 85 | + args := createArgsCryptoComponentsHolder() |
| 86 | + args.BypassBlockSignatureCheck = true |
| 87 | + comp, err := CreateCryptoComponents(args) |
| 88 | + require.NoError(t, err) |
| 89 | + require.NotNil(t, comp) |
| 90 | + require.Equal(t, "*singlesig.DisabledSingleSig", fmt.Sprintf("%T", comp.blockSigner)) |
| 91 | + |
| 92 | + require.Nil(t, comp.Create()) |
| 93 | + require.Nil(t, comp.Close()) |
| 94 | + }) |
79 | 95 | t.Run("NewCryptoComponentsFactory failure should error", func(t *testing.T) { |
80 | 96 | t.Parallel() |
81 | 97 |
|
|
0 commit comments