diff --git a/btcjson/cmdparse_test.go b/btcjson/cmdparse_test.go index 7c13a0bb..dd951dcb 100644 --- a/btcjson/cmdparse_test.go +++ b/btcjson/cmdparse_test.go @@ -201,7 +201,7 @@ func TestAssignFieldErrors(t *testing.T) { }{ { name: "general incompatible int -> string", - dest: string(0), + dest: "\x00", src: int(0), err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, }, diff --git a/wire/message.go b/wire/message.go index e9376477..fe45a11f 100644 --- a/wire/message.go +++ b/wire/message.go @@ -213,7 +213,7 @@ func readMessageHeader(r io.Reader) (int, *messageHeader, error) { readElements(hr, &hdr.magic, &command, &hdr.length, &hdr.checksum) // Strip trailing zeros from command string. - hdr.command = string(bytes.TrimRight(command[:], string(0))) + hdr.command = string(bytes.TrimRight(command[:], "\x00")) return n, &hdr, nil }