From 771ce86080c30680197f96b708303808b307e739 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Fri, 23 Aug 2024 10:24:44 +0500 Subject: [PATCH 1/2] Fix cluster status encoding --- blockchain/pallets/primitives.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain/pallets/primitives.go b/blockchain/pallets/primitives.go index 4fecabc..3051187 100644 --- a/blockchain/pallets/primitives.go +++ b/blockchain/pallets/primitives.go @@ -157,7 +157,7 @@ func (m ClusterStatus) Encode(encoder scale.Encoder) error { for i := 0; i < v.NumField(); i++ { if v.Field(i).Bool() { err1 = encoder.PushByte(byte(i)) - err2 = encoder.Encode(i + 1) // values are defined from 1 + err2 = encoder.Encode(i) break } if i == v.NumField()-1 { From db193facf9d4a195d1861e6b3620b5276f0c9946 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Fri, 23 Aug 2024 10:25:40 +0500 Subject: [PATCH 2/2] Fix cluster status decoding --- blockchain/pallets/primitives.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain/pallets/primitives.go b/blockchain/pallets/primitives.go index 3051187..735b093 100644 --- a/blockchain/pallets/primitives.go +++ b/blockchain/pallets/primitives.go @@ -140,7 +140,7 @@ func (m *ClusterStatus) Decode(decoder scale.Decoder) error { i := int(b) - v := reflect.ValueOf(m) + v := reflect.ValueOf(m).Elem() if i > v.NumField() { return ErrUnknownVariant }