Skip to content

Commit

Permalink
adjusts json keys for 'PoW' and 'HRP'
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-moser committed Jul 25, 2022
1 parent 4b0c89d commit 25b22e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
4 changes: 2 additions & 2 deletions protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 25b22e9

Please sign in to comment.