Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 1bdaf80

Browse files
authored
Merge pull request #402 from iotaledger/fix/json-camel-case
Adjusts json keys for 'PoW' and 'HRP'
2 parents 4b0c89d + 25b22e9 commit 1bdaf80

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

protocol.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ func (p ProtocolParameters) NetworkID() NetworkID {
125125
type jsonProtocolParameters struct {
126126
Version byte `json:"version"`
127127
NetworkName string `json:"networkName"`
128-
Bech32HRP NetworkPrefix `json:"bech32HRP"`
129-
MinPoWScore uint32 `json:"minPoWScore"`
128+
Bech32HRP NetworkPrefix `json:"bech32Hrp"`
129+
MinPoWScore uint32 `json:"minPowScore"`
130130
BelowMaxDepth uint8 `json:"belowMaxDepth"`
131131
RentStructure RentStructure `json:"rentStructure"`
132132
TokenSupply string `json:"tokenSupply"`

protocol_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestProtocolParametersJSONMarshalling(t *testing.T) {
7373
},
7474
TokenSupply: 1234567890987654321,
7575
}
76-
protoParasJSON := `{"version":6,"networkName":"xxxNetwork","bech32HRP":"xxx","minPoWScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}`
76+
protoParasJSON := `{"version":6,"networkName":"xxxNetwork","bech32Hrp":"xxx","minPowScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}`
7777

7878
j, err := json.Marshal(protoParas)
7979
require.NoError(t, err)
@@ -95,7 +95,7 @@ func TestProtocolParametersJSONMarshalling(t *testing.T) {
9595
})
9696
require.NoError(t, err)
9797

98-
expectedJSON := `{"protocol":{"version":6,"networkName":"xxxNetwork","bech32HRP":"xxx","minPoWScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}}`
98+
expectedJSON := `{"protocol":{"version":6,"networkName":"xxxNetwork","bech32Hrp":"xxx","minPowScore":666,"belowMaxDepth":15,"rentStructure":{"vByteCost":6,"vByteFactorData":8,"vByteFactorKey":7},"tokenSupply":"1234567890987654321"}}`
9999
require.Equal(t, expectedJSON, string(structBytes))
100100

101101
decodedStruct := &struct {

0 commit comments

Comments
 (0)