Browse Source

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).
patch-1
SomberNight 5 years ago
parent
commit
46db33df75
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/transaction.py

6
electrum/transaction.py

@ -256,11 +256,11 @@ class BCDataStream(object):
self.write_compact_size(len(string)) self.write_compact_size(len(string))
self.write(string) self.write(string)
def read_bytes(self, length): def read_bytes(self, length) -> bytes:
try: 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 self.read_cursor += length
return result return bytes(result)
except IndexError: except IndexError:
raise SerializationError("attempt to read past end of buffer") from None raise SerializationError("attempt to read past end of buffer") from None

Loading…
Cancel
Save