Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
+ outputs_num
+ has_comment
)
for index in range(n, tx_max):
tx_lines += lines[index]
n += tx_max - n
transaction = Transaction.from_compact(currency, tx_lines)
transactions.append(transaction)
inner_hash = Block.parse_field("InnerHash", lines[n])
n += 1
nonce = int(Block.parse_field("Nonce", lines[n]))
n += 1
signature = Block.parse_field("Signature", lines[n])
return cls(
version,
currency,
number,
powmin,
time,
mediantime,
ud,
unit_base,
issuer,
issuers_frame,
issuers_frame_var,
different_issuers_count,
prev_hash,
prev_issuer,
+ issuers_num * 2
+ inputs_num
+ unlocks_num
+ outputs_num
+ has_comment
)
for index in range(n, tx_max):
tx_lines += lines[index]
n += tx_max - n
transaction = Transaction.from_compact(currency, tx_lines)
transactions.append(transaction)
inner_hash = Block.parse_field("InnerHash", lines[n])
n += 1
nonce = int(Block.parse_field("Nonce", lines[n]))
n += 1
signature = Block.parse_field("Signature", lines[n])
return cls(
version,
currency,
number,
powmin,
time,
mediantime,
ud,
unit_base,
issuer,
issuers_frame,
issuers_frame_var,
lines = signed_raw.splitlines(True)
n = 0
version = int(Block.parse_field("Version", lines[n]))
n += 1
Block.parse_field("Type", lines[n])
n += 1
currency = Block.parse_field("Currency", lines[n])
n += 1
number = int(Block.parse_field("Number", lines[n]))
n += 1
powmin = int(Block.parse_field("PoWMin", lines[n]))
n += 1
time = int(Block.parse_field("Time", lines[n]))
n += 1
mediantime = int(Block.parse_field("MedianTime", lines[n]))
n += 1
ud_match = Block.re_universaldividend.match(lines[n])
ud = None
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
n += 1
unit_base = int(Block.parse_field("UnitBase", lines[n]))
prev_issuer = str(Block.parse_field("PreviousIssuer", lines[n]))
n += 1
parameters = None
if number == 0:
try:
params_match = Block.re_parameters.match(lines[n])
if params_match is None:
raise MalformedDocumentError("Parameters")
parameters = params_match.groups()
n += 1
except AttributeError:
raise MalformedDocumentError("Parameters")
members_count = int(Block.parse_field("MembersCount", lines[n]))
n += 1
identities = []
joiners = []
actives = []
leavers = []
revoked = []
excluded = []
certifications = []
transactions = []
if Block.re_identities.match(lines[n]) is not None:
n += 1
while Block.re_joiners.match(lines[n]) is None:
selfcert = Identity.from_inline(version, currency, lines[n])
identities.append(selfcert)
n += 1
time = int(Block.parse_field("Time", lines[n]))
n += 1
mediantime = int(Block.parse_field("MedianTime", lines[n]))
n += 1
ud_match = Block.re_universaldividend.match(lines[n])
ud = None
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
n += 1
unit_base = int(Block.parse_field("UnitBase", lines[n]))
n += 1
issuer = Block.parse_field("Issuer", lines[n])
n += 1
issuers_frame = Block.parse_field("IssuersFrame", lines[n])
n += 1
issuers_frame_var = Block.parse_field("IssuersFrameVar", lines[n])
n += 1
different_issuers_count = Block.parse_field("DifferentIssuersCount", lines[n])
n += 1
prev_hash = None
prev_issuer = None
if number > 0:
prev_hash = str(Block.parse_field("PreviousHash", lines[n]))
def from_signed_raw(cls: Type[BlockType], signed_raw: str) -> BlockType:
lines = signed_raw.splitlines(True)
n = 0
version = int(Block.parse_field("Version", lines[n]))
n += 1
Block.parse_field("Type", lines[n])
n += 1
currency = Block.parse_field("Currency", lines[n])
n += 1
number = int(Block.parse_field("Number", lines[n]))
n += 1
powmin = int(Block.parse_field("PoWMin", lines[n]))
n += 1
time = int(Block.parse_field("Time", lines[n]))
n += 1
mediantime = int(Block.parse_field("MedianTime", lines[n]))
n += 1
ud_match = Block.re_universaldividend.match(lines[n])
ud = None
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
ud_match = Block.re_universaldividend.match(lines[n])
ud = None
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
n += 1
unit_base = int(Block.parse_field("UnitBase", lines[n]))
n += 1
issuer = Block.parse_field("Issuer", lines[n])
n += 1
issuers_frame = Block.parse_field("IssuersFrame", lines[n])
n += 1
issuers_frame_var = Block.parse_field("IssuersFrameVar", lines[n])
n += 1
different_issuers_count = Block.parse_field("DifferentIssuersCount", lines[n])
n += 1
prev_hash = None
prev_issuer = None
if number > 0:
prev_hash = str(Block.parse_field("PreviousHash", lines[n]))
n += 1
prev_issuer = str(Block.parse_field("PreviousIssuer", lines[n]))
n += 1
parameters = None
if number == 0:
try:
n += 1
powmin = int(Block.parse_field("PoWMin", lines[n]))
n += 1
time = int(Block.parse_field("Time", lines[n]))
n += 1
mediantime = int(Block.parse_field("MedianTime", lines[n]))
n += 1
ud_match = Block.re_universaldividend.match(lines[n])
ud = None
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
n += 1
unit_base = int(Block.parse_field("UnitBase", lines[n]))
n += 1
issuer = Block.parse_field("Issuer", lines[n])
n += 1
issuers_frame = Block.parse_field("IssuersFrame", lines[n])
n += 1
issuers_frame_var = Block.parse_field("IssuersFrameVar", lines[n])
n += 1
different_issuers_count = Block.parse_field("DifferentIssuersCount", lines[n])
n += 1
prev_hash = None
version = int(Block.parse_field("Version", lines[n]))
n += 1
Block.parse_field("Type", lines[n])
n += 1
currency = Block.parse_field("Currency", lines[n])
n += 1
number = int(Block.parse_field("Number", lines[n]))
n += 1
powmin = int(Block.parse_field("PoWMin", lines[n]))
n += 1
time = int(Block.parse_field("Time", lines[n]))
n += 1
mediantime = int(Block.parse_field("MedianTime", lines[n]))
n += 1
ud_match = Block.re_universaldividend.match(lines[n])
ud = None
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
n += 1
unit_base = int(Block.parse_field("UnitBase", lines[n]))
n += 1
issuer = Block.parse_field("Issuer", lines[n])
unit_base = 0
if ud_match is not None:
ud = int(Block.parse_field("UD", lines[n]))
n += 1
unit_base = int(Block.parse_field("UnitBase", lines[n]))
n += 1
issuer = Block.parse_field("Issuer", lines[n])
n += 1
issuers_frame = Block.parse_field("IssuersFrame", lines[n])
n += 1
issuers_frame_var = Block.parse_field("IssuersFrameVar", lines[n])
n += 1
different_issuers_count = Block.parse_field("DifferentIssuersCount", lines[n])
n += 1
prev_hash = None
prev_issuer = None
if number > 0:
prev_hash = str(Block.parse_field("PreviousHash", lines[n]))
n += 1
prev_issuer = str(Block.parse_field("PreviousIssuer", lines[n]))
n += 1
parameters = None
if number == 0:
try:
params_match = Block.re_parameters.match(lines[n])
if params_match is None: