Correct unmarshal for GetAddressBalanceCmd.
The unmarshaller for the GetAddressBalanceCmd was calling the wrong parse function. It wasn't caught by the tests because the error on UnmarshalJSON was being ignored, so this commit also updates the tests to check the error.
This commit is contained in:
parent
bfcd7f6790
commit
6f08ca8a8a
2 changed files with 5 additions and 2 deletions
2
cmds.go
2
cmds.go
|
@ -1636,7 +1636,7 @@ func (cmd *GetAddressBalanceCmd) UnmarshalJSON(b []byte) error {
|
|||
return err
|
||||
}
|
||||
|
||||
newCmd, err := parseListAllTransactionsCmd(&r)
|
||||
newCmd, err := parseGetAddressBalanceCmd(&r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -346,7 +346,10 @@ func TestCmds(t *testing.T) {
|
|||
|
||||
// Read marshaled command back into c. Should still
|
||||
// match result.
|
||||
c.UnmarshalJSON(mc)
|
||||
if err := c.UnmarshalJSON(mc); err != nil {
|
||||
t.Errorf("%s: error while unmarshalling: %v", test.name,
|
||||
err)
|
||||
}
|
||||
if !reflect.DeepEqual(test.result, c) {
|
||||
t.Errorf("%s: unmarshal not as expected. "+
|
||||
"got %v wanted %v", test.name, spew.Sdump(c),
|
||||
|
|
Loading…
Reference in a new issue