minor cleanups
This commit is contained in:
parent
6967456f8f
commit
2c3fa1c49a
6 changed files with 17 additions and 17 deletions
|
|
@ -43,7 +43,7 @@ opts_data = {
|
|||
-A, --abort Abort an unsent transaction created by ‘mmgen-txcreate
|
||||
--autosign’ and delete it from the removable device. The
|
||||
transaction may be signed or unsigned.
|
||||
-d, --outdir= d Specify an alternate directory 'd' for output
|
||||
-d, --outdir=d Specify an alternate directory 'd' for output
|
||||
-H, --dump-hex=F Instead of sending to the network, dump the transaction hex
|
||||
to file ‘F’. Use filename ‘-’ to dump to standard output.
|
||||
-m, --mark-sent Mark the transaction as sent by adding it to the removable
|
||||
|
|
@ -97,6 +97,7 @@ if not cfg.status:
|
|||
do_license_msg(cfg)
|
||||
|
||||
from .tx import OnlineSignedTX, SentTX
|
||||
from .ui import keypress_confirm
|
||||
|
||||
async def post_send(tx):
|
||||
tx2 = await SentTX(cfg=cfg, data=tx.__dict__, automount=cfg.autosign)
|
||||
|
|
@ -153,7 +154,6 @@ async def main():
|
|||
ask_overwrite = False,
|
||||
ask_tty = False)
|
||||
if cfg.autosign:
|
||||
from .ui import keypress_confirm
|
||||
if keypress_confirm(cfg, 'Mark transaction as sent on removable device?'):
|
||||
await post_send(tx)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ class Base(TxBase.Base):
|
|||
# given absolute fee in ETH, return gas price for display in selected unit
|
||||
def fee_abs2rel(self, abs_fee, *, to_unit='Gwei'):
|
||||
return self.pretty_fmt_fee(
|
||||
self.fee_abs2gas(abs_fee).to_unit(to_unit))
|
||||
self.fee_abs2gasprice(abs_fee).to_unit(to_unit))
|
||||
|
||||
# given absolute fee in ETH, return gas price in ETH
|
||||
def fee_abs2gas(self, abs_fee):
|
||||
def fee_abs2gasprice(self, abs_fee):
|
||||
return self.proto.coin_amt(int(abs_fee.toWei() // self.gas.toWei()), from_unit='wei')
|
||||
|
||||
# given rel fee (gasPrice) in wei, return absolute fee using self.gas (Ethereum-only method)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class Bump(Completed, New, TxBase.Bump):
|
|||
return self.fee * Decimal('1.101')
|
||||
|
||||
def bump_fee(self, idx, fee):
|
||||
self.txobj['gasPrice'] = self.fee_abs2gas(fee)
|
||||
self.txobj['gasPrice'] = self.fee_abs2gasprice(fee)
|
||||
|
||||
async def get_nonce(self):
|
||||
return self.txobj['nonce']
|
||||
|
|
|
|||
|
|
@ -55,12 +55,11 @@ class New(Base, TxBase.New):
|
|||
'from': self.inputs[0].addr,
|
||||
'to': self.outputs[0].addr if self.outputs else None,
|
||||
'amt': self.outputs[0].amt if self.outputs else self.proto.coin_amt('0'),
|
||||
'gasPrice': self.fee_abs2gas(self.usr_fee),
|
||||
'gasPrice': self.fee_abs2gasprice(self.usr_fee),
|
||||
'startGas': self.start_gas,
|
||||
'nonce': await self.get_nonce(),
|
||||
'chainId': self.rpc.chainID,
|
||||
'data': self.usr_contract_data,
|
||||
}
|
||||
'data': self.usr_contract_data}
|
||||
|
||||
# Instead of serializing tx data as with BTC, just create a JSON dump.
|
||||
# This complicates things but means we avoid using the rlp library to deserialize the data,
|
||||
|
|
|
|||
|
|
@ -220,6 +220,15 @@ def cliargs_convert(args):
|
|||
|
||||
return tuple(gen())
|
||||
|
||||
def port_in_use(port):
|
||||
import socket
|
||||
try:
|
||||
socket.create_connection(('localhost', port)).close()
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
class ExpInt(int):
|
||||
'encode or parse an integer in exponential notation with specified precision'
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from subprocess import run, PIPE
|
|||
from collections import namedtuple
|
||||
|
||||
from mmgen.util import msg, fmt, async_run, capfirst, is_int, die, list_gen
|
||||
from mmgen.util2 import port_in_use
|
||||
from mmgen.obj import MMGenRange
|
||||
from mmgen.amt import XMRAmt
|
||||
from mmgen.addrlist import ViewKeyAddrList, KeyAddrList, AddrIdxList
|
||||
|
|
@ -155,15 +156,6 @@ class CmdTestXMRWallet(CmdTestBase):
|
|||
@classmethod
|
||||
def init_proxy(cls, external_call=False):
|
||||
|
||||
def port_in_use(port):
|
||||
import socket
|
||||
try:
|
||||
socket.create_connection(('localhost', port)).close()
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def start_proxy():
|
||||
if external_call or not cfg.no_daemon_autostart:
|
||||
run(a+b2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue