From bb6ef42d0c7949e786ff44c883fd93a881331a26 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 11 Nov 2019 16:08:28 -0500 Subject: [PATCH] added support for lbrycrd v0.17.3.1 --- lbry/lbry/wallet/__init__.py | 2 +- torba/torba/server/tx.py | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lbry/lbry/wallet/__init__.py b/lbry/lbry/wallet/__init__.py index 5bda0326e..6f73cc34d 100644 --- a/lbry/lbry/wallet/__init__.py +++ b/lbry/lbry/wallet/__init__.py @@ -2,7 +2,7 @@ __node_daemon__ = 'lbrycrdd' __node_cli__ = 'lbrycrd-cli' __node_bin__ = '' __node_url__ = ( - 'https://github.com/lbryio/lbrycrd/releases/download/v0.17.2.1/lbrycrd-linux.zip' + 'https://github.com/lbryio/lbrycrd/releases/download/v0.17.3.1/lbrycrd-linux-1731.zip' ) __spvserver__ = 'lbry.wallet.server.coin.LBCRegTest' diff --git a/torba/torba/server/tx.py b/torba/torba/server/tx.py index 0074a0586..e240bef36 100644 --- a/torba/torba/server/tx.py +++ b/torba/torba/server/tx.py @@ -101,14 +101,26 @@ class Deserializer: self.binary = binary self.binary_length = len(binary) self.cursor = start + self.flags = 0 def read_tx(self): """Return a deserialized transaction.""" + version = self._read_le_int32() + inputs = self._read_inputs() + outputs = self._read_outputs() + if self.flags == 1: + # drain witness portion of transaction + # too many witnesses for no crime + for i in range(len(inputs)): + for v in range(self._read_varint()): + self._read_varbytes() + self.flags = 0 + locktime = self._read_le_uint32() return Tx( - self._read_le_int32(), # version - self._read_inputs(), # inputs - self._read_outputs(), # outputs - self._read_le_uint32() # locktime + version, + inputs, + outputs, + locktime ) def read_tx_and_hash(self): @@ -132,7 +144,11 @@ class Deserializer: def _read_inputs(self): read_input = self._read_input - return [read_input() for i in range(self._read_varint())] + num_inputs = self._read_varint() + if num_inputs == 0: + self.flags = self._read_byte() + num_inputs = self._read_varint() + return [read_input() for i in range(num_inputs)] def _read_input(self): return TxInput(