Handle pubkey's checksum in the tx code
The following discussion from !132 (merged) should be addressed:
-
@matograine started a discussion: (+3 comments) Seems like there is a bug in the tx.py module. (I use the checksum example given by Tortue)
silkaj --gtest tx -r Hvrm4fZQWQ2M26wNczZcijce7cB8XQno2NPTwf5MovPa:5XP -a 100 Please enter your Scrypt Salt (Secret identifier): Please enter your Scrypt password (masked): ╒════════════════════════════════════════════╤══════════════════════════════════════════════════╕ │ pubkey's balance before tx (unit|relative) │ 96678.75 ĞTest | 9.6756 UD ĞTest │ ├────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ total transaction amount (unit|relative) │ 100.0 ĞTest | 0.01 UD ĞTest │ ├────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ pubkey's balance after tx (unit|relative) │ 96578.75 ĞTest | 9.6656 UD ĞTest │ ├────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ from (pubkey) │ AhRMHUxMPXSeG7qXZrE6qCdjwK9p2bu5Eqei7xAWVEDK │ ├────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ to (pubkey) │ Hvrm4fZQWQ2M26wNczZcijce7cB8XQno2NPTwf5MovPa:5XP │ ├────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ amount (unit|relative) │ 100.0 ĞTest | 0.01 UD ĞTest │ ├────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ comment │ │ ╘════════════════════════════════════════════╧══════════════════════════════════════════════════╛ Do you confirm sending this transaction? [yes/no]: yes Generate Transaction: - From: AhRMHUxMPXSeG7qXZrE6qCdjwK9p2bu5Eqei7xAWVEDK - To: Hvrm4fZQWQ2M26wNczZcijce7cB8XQno2NPTwf5MovPa:5XP - Amount: 100.0 - Total: 100.0 Traceback (most recent call last): File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/bin/silkaj", line 11, in <module> load_entry_point('silkaj', 'console_scripts', 'silkaj')() File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/mnt/DATA/Users/bob/Documents/Associatif/June/Developpement/dev-silkaj/silkaj-multi_output/silkaj/tools.py", line 70, in wrapper return loop.run_until_complete(f(*args, **kwargs)) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "/mnt/DATA/Users/bob/Documents/Associatif/June/Developpement/dev-silkaj/silkaj-multi_output/silkaj/tx.py", line 141, in send_transaction key, issuer_pubkey, tx_amounts, recipients, comment, outputbackchange, File "/mnt/DATA/Users/bob/Documents/Associatif/June/Developpement/dev-silkaj/silkaj-multi_output/silkaj/tx.py", line 301, in handle_intermediaries_transactions OutputbackChange, File "/mnt/DATA/Users/bob/Documents/Associatif/June/Developpement/dev-silkaj/silkaj-multi_output/silkaj/tx.py", line 339, in generate_and_send_transaction transaction.sign([key]) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/duniterpy/documents/document.py", line 84, in sign signing = base64.b64encode(key.signature(bytes(self.raw(), "ascii"))) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/duniterpy/documents/transaction.py", line 839, in raw doc += "{0}\n".format(o.inline()) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/duniterpy/documents/transaction.py", line 201, in inline self.amount, self.base, pypeg2.compose(self.condition, output.Condition) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/pypeg2/__init__.py", line 699, in compose return parser.compose(thing, grammar) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/pypeg2/__init__.py", line 1299, in compose return terminal_indent() + thing.compose(self, attr_of=attr_of) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/duniterpy/grammars/output.py", line 383, in compose left = parser.compose(self.left, grammar=grammar, attr_of=attr_of) File "/home/thomas/.cache/pypoetry/virtualenvs/silkaj-HKHTj0CI-py3.7/lib/python3.7/site-packages/pypeg2/__init__.py", line 1333, in compose + grammar.pattern) ValueError: '' does not match \w+ ERROR:asyncio:Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7fc8c1496080> ERROR:asyncio:Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fc8c14fbd48>, 83529.411582788)]'] connector: <aiohttp.connector.TCPConnector object at 0x7fc8c1496048>
Edited by Moul