For the above input, Bitcoin-core fails while trying to deserialize and throws the error ReadCompactSize(): size too large.
This issue partly seems to be due to incorrect implementation of bip-174. Bip-174 says that keytype is a compact size int and from what I see btcd simply treats keytypeas a single byte.
The test case given below can be used to reproduce this issue:
func TestKeyType(t *testing.T) {
k, _ := hex.DecodeString("70736274ff01001c000000000002000000000000000000000000736210ff01000001010010ff70ff01001c00000000000000000000000000000000000000000000")
if _, err := NewFromRawBytes(bytes.NewReader(k), false); err == nil {
require.Error(t, err, "Err should not be nil")
}
}
Hello,
BTCD does not fail as it should when trying to deserialize the following bytes:
70736274ff01001c000000000002000000000000000000000000736210ff01000001010010ff70ff01001c00000000000000000000000000000000000000000000
For the above input, Bitcoin-core fails while trying to deserialize and throws the error
ReadCompactSize(): size too large
.This issue partly seems to be due to incorrect implementation of bip-174. Bip-174 says that
keytype
is acompact size int
and from what I see btcd simply treatskeytype
as a single byte.The test case given below can be used to reproduce this issue:
cc: @brunoerg