From 46db33df7532e9585d8e742a2a8ba0e2f6d79b5e Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 5 Nov 2019 23:35:32 +0100 Subject: [PATCH] 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). --- electrum/transaction.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electrum/transaction.py b/electrum/transaction.py index 09cd640a7..e8ee265e4 100644 --- a/electrum/transaction.py +++ b/electrum/transaction.py @@ -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