NewTX, BumpTX: remove unnecessary async call

This commit is contained in:
The MMGen Project 2025-05-10 10:43:23 +00:00
commit 131787afb8
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
9 changed files with 13 additions and 13 deletions

View file

@ -188,7 +188,7 @@ async def main():
msg(orig_tx.info.format(terse=True))
from .tw.ctl import TwCtl
tx = await BumpTX(
tx = BumpTX(
cfg = cfg,
data = orig_tx.__dict__,
automount = cfg.autosign,

View file

@ -135,7 +135,7 @@ async def main():
proto = cfg._proto
from .tx import NewTX
tx1 = await NewTX(cfg=cfg, proto=proto, target=target)
tx1 = NewTX(cfg=cfg, proto=proto, target=target)
tx2 = await tx1.create(
cmd_args = cfg._args,

View file

@ -170,7 +170,7 @@ async def main():
else:
proto = cfg._proto
tx1 = await NewTX(cfg=cfg, proto=proto, target=target)
tx1 = NewTX(cfg=cfg, proto=proto, target=target)
tx2 = await tx1.create(
cmd_args = cfg._args,

View file

@ -67,7 +67,7 @@ class Unsigned(Completed, TxBase.Unsigned):
try:
self.update_serialized(ret['hex'])
from ....tx import SignedTX
new = await SignedTX(cfg=self.cfg, data=self.__dict__, automount=self.automount)
new = SignedTX(cfg=self.cfg, data=self.__dict__, automount=self.automount)
tx_decoded = await self.rpc.call('decoderawtransaction', ret['hex'])
new.compare_size_and_estimated_size(tx_decoded)
new.coin_txid = CoinTxID(self.deserialized.txid)

View file

@ -246,7 +246,7 @@ class TokenNew(TokenBase, New):
data = t.create_transfer_data(
to_addr = to_addr or self.outputs[0].addr,
amt = self.outputs[0].amt or await self.twuo.twctl.get_balance(self.inputs[0].addr),
amt = self.outputs[0].amt or await self.twctl.get_balance(self.inputs[0].addr),
op = self.token_op)
try:

View file

@ -95,7 +95,7 @@ class Unsigned(Completed, TxBase.Unsigned):
await self.do_sign(o, keys[0].sec.wif)
msg('OK')
from ....tx import SignedTX
tx = await SignedTX(cfg=self.cfg, data=self.__dict__, automount=self.automount)
tx = SignedTX(cfg=self.cfg, data=self.__dict__, automount=self.automount)
tx.check_serialized_integrity()
return tx
except Exception as e:

View file

@ -77,8 +77,6 @@ async def _get_obj_async(_clsname, _modname, **kwargs):
# No twctl required for the Unsigned and Signed(data=unsigned.__dict__) classes used during
# signing.
if proto and proto.tokensym and clsname in (
'New',
'NewSwap',
'OnlineSigned',
'AutomountOnlineSigned',
'Sent',
@ -95,12 +93,12 @@ def _get_async(clsname, modname):
return lambda **kwargs: _get_obj_async(clsname, modname, **kwargs)
BaseTX = _get('Base', 'base')
NewTX = _get('New', 'new')
NewSwapTX = _get('NewSwap', 'new_swap')
BumpTX = _get('Bump', 'bump')
UnsignedTX = _get('Unsigned', 'unsigned')
SignedTX = _get('Signed', 'signed')
NewTX = _get_async('New', 'new')
NewSwapTX = _get_async('NewSwap', 'new_swap')
CompletedTX = _get_async('Completed', 'completed')
SignedTX = _get_async('Signed', 'signed')
OnlineSignedTX = _get_async('OnlineSigned', 'online')
SentTX = _get_async('Sent', 'online')
BumpTX = _get_async('Bump', 'bump')

View file

@ -469,6 +469,7 @@ class New(Base):
minconf = self.cfg.minconf,
addrs = await self.get_input_addrs_from_inputs_opt())
await self.twuo.get_data()
self.twctl = self.twuo.twctl
from ..ui import do_license_msg
do_license_msg(self.cfg)
@ -480,6 +481,7 @@ class New(Base):
self.twuo.display_total()
if do_info:
del self.twctl
del self.twuo.twctl
import sys
sys.exit(0)

View file

@ -114,7 +114,7 @@ class unit_tests:
d.start()
proto = init_proto(cfg, 'btc', need_amt=True)
await NewTX(cfg=cfg, proto=proto, target='tx')
NewTX(cfg=cfg, proto=proto, target='tx')
d.stop()
d.remove_datadir()