Skip to content

Commit 402c030

Browse files
committed
Fix milestone parsing
1 parent 0ab6c16 commit 402c030

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

consensus/bor/heimdall/milestone/milestone.go

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package milestone
22

33
import (
4+
"encoding/base64"
45
"encoding/json"
56
"fmt"
67
"strconv"
@@ -24,6 +25,7 @@ func (m *Milestone) UnmarshalJSON(data []byte) error {
2425
temp := &struct {
2526
StartBlock string `json:"start_block"`
2627
EndBlock string `json:"end_block"`
28+
Hash string `json:"hash"`
2729
*Alias
2830
}{
2931
Alias: (*Alias)(m),
@@ -45,6 +47,12 @@ func (m *Milestone) UnmarshalJSON(data []byte) error {
4547
}
4648
m.EndBlock = endBlock
4749

50+
decodedHash, err := base64.StdEncoding.DecodeString(temp.Hash)
51+
if err != nil {
52+
return fmt.Errorf("failed to decode hash: %w", err)
53+
}
54+
m.Hash = common.BytesToHash(decodedHash)
55+
4856
return nil
4957
}
5058

0 commit comments

Comments
 (0)