Commit e10c515a authored by Moul's avatar Moul

[mod] Tx document: drop vensions 3 management

parent c8403bee
Pipeline #5411 passed with stages
in 3 minutes and 1 second
...@@ -486,8 +486,7 @@ class Transaction(Document): ...@@ -486,8 +486,7 @@ class Transaction(Document):
tx_data["currency"] = currency tx_data["currency"] = currency
for data_list in ('issuers', 'outputs', 'inputs', 'unlocks', 'signatures'): for data_list in ('issuers', 'outputs', 'inputs', 'unlocks', 'signatures'):
tx_data['multiline_{0}'.format(data_list)] = '\n'.join(tx_data[data_list]) tx_data['multiline_{0}'.format(data_list)] = '\n'.join(tx_data[data_list])
if tx_data["version"] >= 3: return cls.from_signed_raw("""Version: {version}
signed_raw = """Version: {version}
Type: Transaction Type: Transaction
Currency: {currency} Currency: {currency}
Blockstamp: {blockstamp} Blockstamp: {blockstamp}
...@@ -502,24 +501,7 @@ Outputs: ...@@ -502,24 +501,7 @@ Outputs:
{multiline_outputs} {multiline_outputs}
Comment: {comment} Comment: {comment}
{multiline_signatures} {multiline_signatures}
""".format(**tx_data) """.format(**tx_data))
else:
signed_raw = """Version: {version}
Type: Transaction
Currency: {currency}
Locktime: {locktime}
Issuers:
{multiline_issuers}
Inputs:
{multiline_inputs}
Unlocks:
{multiline_unlocks}
Outputs:
{multiline_outputs}
Comment: {comment}
{multiline_signatures}
""".format(**tx_data)
return cls.from_signed_raw(signed_raw)
@classmethod @classmethod
def from_compact(cls: Type[TransactionType], currency: str, compact: str) -> TransactionType: def from_compact(cls: Type[TransactionType], currency: str, compact: str) -> TransactionType:
...@@ -613,8 +595,6 @@ Comment: {comment} ...@@ -613,8 +595,6 @@ Comment: {comment}
currency = Transaction.parse_field("Currency", lines[n]) currency = Transaction.parse_field("Currency", lines[n])
n += 1 n += 1
blockstamp = None # type: Optional[BlockUID]
if version >= 3:
blockstamp = BlockUID.from_str(Transaction.parse_field("Blockstamp", lines[n])) blockstamp = BlockUID.from_str(Transaction.parse_field("Blockstamp", lines[n]))
n += 1 n += 1
...@@ -679,7 +659,6 @@ Currency: {1} ...@@ -679,7 +659,6 @@ Currency: {1}
""".format(self.version, """.format(self.version,
self.currency) self.currency)
if self.version >= 3:
doc += "Blockstamp: {0}\n".format(self.blockstamp) doc += "Blockstamp: {0}\n".format(self.blockstamp)
doc += "Locktime: {0}\n".format(self.locktime) doc += "Locktime: {0}\n".format(self.locktime)
...@@ -727,7 +706,6 @@ COMMENT ...@@ -727,7 +706,6 @@ COMMENT
len(self.outputs), len(self.outputs),
'1' if self.comment != "" else '0', '1' if self.comment != "" else '0',
self.locktime) self.locktime)
if self.version >= 3:
doc += "{0}\n".format(self.blockstamp) doc += "{0}\n".format(self.blockstamp)
for pubkey in self.issuers: for pubkey in self.issuers:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment