From 25b22e922feaadc6c34518443d2313f9af33bea8 Mon Sep 17 00:00:00 2001 From: Luca Moser Date: Mon, 25 Jul 2022 14:08:28 +0200 Subject: [PATCH] adjusts json keys for 'PoW' and 'HRP' --- protocol.go | 4 ++-- protocol_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol.go b/protocol.go index 4f2a67825..57738f98d 100644 --- a/protocol.go +++ b/protocol.go @@ -125,8 +125,8 @@ func (p ProtocolParameters) NetworkID() NetworkID { type jsonProtocolParameters struct { Version byte `json:"version"` NetworkName string `json:"networkName"` - Bech32HRP NetworkPrefix `json:"bech32HRP"` - MinPoWScore uint32 `json:"minPoWScore"` + Bech32HRP NetworkPrefix `json:"bech32Hrp"` + MinPoWScore uint32 `json:"minPowScore"` BelowMaxDepth uint8 `json:"belowMaxDepth"` RentStructure RentStructure `json:"rentStructure"` TokenSupply string `json:"tokenSupply"` diff --git a/protocol_test.go b/protocol_test.go index 0982c646f..758e011bf 100644 --- a/protocol_test.go +++ b/protocol_test.go @@ -73,7 +73,7 @@ func TestProtocolParametersJSONMarshalling(t *testing.T) { }, TokenSupply: 1234567890987654321, } - protoParasJSON := `{"version":6,"networkName":"xxxNetwork","bech32HRP":"xxx","minPoWScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}` + protoParasJSON := `{"version":6,"networkName":"xxxNetwork","bech32Hrp":"xxx","minPowScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}` j, err := json.Marshal(protoParas) require.NoError(t, err) @@ -95,7 +95,7 @@ func TestProtocolParametersJSONMarshalling(t *testing.T) { }) require.NoError(t, err) - expectedJSON := `{"protocol":{"version":6,"networkName":"xxxNetwork","bech32HRP":"xxx","minPoWScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}}` + expectedJSON := `{"protocol":{"version":6,"networkName":"xxxNetwork","bech32Hrp":"xxx","minPowScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}}` require.Equal(t, expectedJSON, string(structBytes)) decodedStruct := &struct {