@@ -18,6 +18,29 @@ import (
1818var (
1919 errThresholdInvalid = errors .New ("threshold must be greater than 0" )
2020 errKeySharesNotGenerated = errors .New ("to initialize shares you must generate the keys" )
21+
22+ quorumParams = map [btcjson.LLMQType ]struct {
23+ Members int
24+ Threshold int
25+ }{
26+ btcjson .LLMQType_50_60 : {50 , 30 },
27+ btcjson .LLMQType_400_60 : {400 , 240 },
28+ btcjson .LLMQType_400_85 : {400 , 340 },
29+ btcjson .LLMQType_100_67 : {100 , 67 },
30+ btcjson .LLMQType_60_75 : {60 , 45 },
31+ btcjson .LLMQType_25_67 : {25 , 16 },
32+ btcjson .LLMQType_DEVNET : {12 , 6 },
33+ btcjson .LLMQType_TEST_V17 : {3 , 2 },
34+ btcjson .LLMQType_TEST_DIP0024 : {4 , 2 },
35+ btcjson .LLMQType_TEST_INSTANTSEND : {3 , 2 },
36+ btcjson .LLMQType_DEVNET_DIP0024 : {8 , 4 },
37+ btcjson .LLMQType_TEST_PLATFORM : {3 , 2 },
38+ btcjson .LLMQType_DEVNET_PLATFORM : {12 , 8 },
39+
40+ // temporarily commented out due to the default behavior where if llmq type is not found
41+ // then we take the length of the actual validators as members
42+ //btcjson.LLMQType_TEST: {3, 2},
43+ }
2144)
2245
2346type optionFunc func (c * llmqConfig )
@@ -43,24 +66,16 @@ type blsLLMQData struct {
4366 pkShares []* bls.G1Element
4467}
4568
46- // QuorumProps returns corresponding LLMQ parameters
69+ // QuorumParams returns corresponding LLMQ parameters
4770// the first integer is an expected size of quorum
4871// the second is an expected threshold
4972// the third parameter is an error, it returns in a case if quorumType is not supported
50- func QuorumProps (quorumType btcjson.LLMQType ) (int , int , error ) {
51- switch quorumType {
52- case btcjson .LLMQType_50_60 :
53- return 50 , 30 , nil
54- case btcjson .LLMQType_400_60 :
55- return 400 , 240 , nil
56- case btcjson .LLMQType_400_85 :
57- return 400 , 340 , nil
58- case btcjson .LLMQType_100_67 :
59- return 100 , 67 , nil
60- case 101 :
61- return 10 , 6 , nil
73+ func QuorumParams (quorumType btcjson.LLMQType ) (int , int , error ) {
74+ params , ok := quorumParams [quorumType ]
75+ if ! ok {
76+ return 0 , 0 , fmt .Errorf ("quorumType '%d' doesn't match with available" , quorumType )
6277 }
63- return 0 , 0 , fmt . Errorf ( "quorumType '%d' doesn't match with available" , quorumType )
78+ return params . Members , params . Threshold , nil
6479}
6580
6681// MustGenerate generates long-living master node quorum, but panics if a got error
0 commit comments