From 0daa11d72c32d5a166cb5052395ab85b43742f86 Mon Sep 17 00:00:00 2001 From: Dmitrii Golubev Date: Tue, 21 Feb 2023 18:36:06 +0100 Subject: [PATCH] feat: add a couple of new LLMQ types (#17) * feat: add two more LLMQ types, LLMQType_TEST_PLATFORM (106) and LLMQType_DEVNET_PLATFORM (107) --- btcjson/dashevocmds.go | 8 ++++++-- btcjson/dashevocmds_test.go | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/btcjson/dashevocmds.go b/btcjson/dashevocmds.go index 159aeb7924..7b3a1d2741 100644 --- a/btcjson/dashevocmds.go +++ b/btcjson/dashevocmds.go @@ -136,6 +136,8 @@ const ( LLMQType_TEST_DIP0024 LLMQType = 103 // 4 members, 2 (66%) threshold, one per hour LLMQType_TEST_INSTANTSEND LLMQType = 104 // 3 members, 2 (66%) threshold, one per hour LLMQType_DEVNET_DIP0024 LLMQType = 105 // 8 members, 4 (50%) threshold, one per hour + LLMQType_TEST_PLATFORM LLMQType = 106 // 3 members, 2 (66%) threshold, one per hour + LLMQType_DEVNET_PLATFORM LLMQType = 107 // 12 members, 8 (67%) threshold, one per hour // LLMQType_5_60 is replaced with LLMQType_TEST to adhere to DIP-0006 naming LLMQType_5_60 LLMQType = LLMQType_TEST @@ -145,7 +147,7 @@ var ( errWrongSizeOfArgs = errors.New("wrong size of arguments") errQuorumUnmarshalerNotFound = errors.New("quorum unmarshaler not found") - llmqTypes map[string]LLMQType = map[string]LLMQType{ + llmqTypes = map[string]LLMQType{ "llmq_50_60": LLMQType_50_60, "llmq_400_60": LLMQType_400_60, "llmq_400_85": LLMQType_400_85, @@ -157,6 +159,8 @@ var ( "llmq_test_dip0024": LLMQType_TEST_DIP0024, "llmq_test_instantsend": LLMQType_TEST_INSTANTSEND, "llmq_devnet_dip0024": LLMQType_DEVNET_DIP0024, + "llmq_test_platform": LLMQType_TEST_PLATFORM, + "llmq_devnet_platform": LLMQType_DEVNET_PLATFORM, } ) @@ -182,7 +186,7 @@ func (t LLMQType) Name() string { // defined in accordance with DIP-0006. // See https://github.com/dashpay/dips/blob/master/dip-0006/llmq-types.md func (t LLMQType) Validate() error { - if (t >= LLMQType_50_60 && t <= LLMQType_60_75) || (t >= LLMQType_TEST && t <= LLMQType_DEVNET_DIP0024) { + if (t >= LLMQType_50_60 && t <= LLMQType_60_75) || (t >= LLMQType_TEST && t <= LLMQType_DEVNET_PLATFORM) { return nil } diff --git a/btcjson/dashevocmds_test.go b/btcjson/dashevocmds_test.go index cf872ae569..de8edebfab 100644 --- a/btcjson/dashevocmds_test.go +++ b/btcjson/dashevocmds_test.go @@ -183,7 +183,20 @@ func TestLLMQTypeValidate(t *testing.T) { testCases := []struct { llmqType btcjson.LLMQType expectErr bool - }{{-1, true}, {0, true}, {1, false}, {2, false}, {5, false}, {6, true}, {99, true}, {100, false}, {105, false}, {106, true}} + }{ + {-1, true}, + {0, true}, + {1, false}, + {2, false}, + {5, false}, + {6, true}, + {99, true}, + {100, false}, + {105, false}, + {106, false}, + {107, false}, + {108, true}, + } for _, tc := range testCases { t.Run(strconv.Itoa(int(tc.llmqType)), func(t *testing.T) {