btcjson,wire: fix invalid use of string(x) to convert byte value
This commit is contained in:
parent
d13e907952
commit
35194e2dac
2 changed files with 2 additions and 2 deletions
|
@ -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},
|
||||
},
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue