psbt: follow-ups: BCDataStream.read_bytes() should return bytes
This fixes keepkey, as in particular the code in the plugin expected TxOutpoint.txid to be bytes not a bytearray (and the TxOutpoint named tuple itself claims txid to be bytes).
This commit is contained in:
@@ -256,11 +256,11 @@ class BCDataStream(object):
|
||||
self.write_compact_size(len(string))
|
||||
self.write(string)
|
||||
|
||||
def read_bytes(self, length):
|
||||
def read_bytes(self, length) -> bytes:
|
||||
try:
|
||||
result = self.input[self.read_cursor:self.read_cursor+length]
|
||||
result = self.input[self.read_cursor:self.read_cursor+length] # type: bytearray
|
||||
self.read_cursor += length
|
||||
return result
|
||||
return bytes(result)
|
||||
except IndexError:
|
||||
raise SerializationError("attempt to read past end of buffer") from None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user