tx.tx_proxy.send_tx(): add test param

This commit is contained in:
The MMGen Project 2026-10-27 13:30:14 +00:00
commit 8b27679202
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 4 additions and 4 deletions

View file

@ -123,7 +123,7 @@ class OnlineSigned(Signed):
await asyncio.sleep(2)
from .tx_proxy import send_tx
msg('{} TX: {}'.format('Testing' if cfg.test else 'Sending', coin_txid.hl()))
if ret := send_tx(cfg, txhex):
if ret := send_tx(cfg, txhex, test=cfg.test):
if ret != coin_txid:
ymsg(f'Warning: txid mismatch (after sending) ({ret} != {coin_txid})')
sent_status = 'confirm_post_send'

View file

@ -131,7 +131,7 @@ class EtherscanTxProxyClient(TxProxyClient):
msg(f'{type(e).__name__}: {e}')
return CoinTxID(txid) if is_coin_txid(txid) else False
def send_tx(cfg, txhex):
def send_tx(cfg, txhex, *, test=False):
c = get_client(cfg)
msg(f'Using {pink(cfg.tx_proxy.upper())} tx proxy')
@ -147,10 +147,10 @@ def send_tx(cfg, txhex):
tx_hex = txhex)
msg('done')
if cfg.test:
if test:
msg(f'Form retrieved from {orange(c.host)} and parsed')
msg(green('Transaction can be sent'))
return False
return None
msg_r('Sending data...')
result_text = c.post_form(data=post_data, timeout=180)