proto.vm.tx.new: check data arg with DataOutput

This commit is contained in:
The MMGen Project 2026-09-06 10:08:42 +00:00
commit 7d31c25a20
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -43,9 +43,10 @@ class New:
async def process_cmdline_args(self, cmd_args, ad_f, ad_w):
def process_data_arg(arg):
assert arg.startswith('data:'), f'{arg}: invalid data arg (must start with "data:")'
self.swap_memo = arg.removeprefix('data:')
self.set_gas_with_data(self.swap_memo.encode())
from ....tx.data_output import DataOutput
res = DataOutput(self.proto, arg) # test data for validity
self.swap_memo = str(res)
self.set_gas_with_data(res)
match len(cmd_args):
case 1: