added support for lbrycrd v0.17.3.1

This commit is contained in:
Lex Berezhny 2019-11-11 16:08:28 -05:00
parent 3c591d4968
commit bb6ef42d0c
2 changed files with 22 additions and 6 deletions

View file

@ -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'

View file

@ -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(