minor changes and fixes
This commit is contained in:
parent
b57e7a74f2
commit
7a8652cd32
5 changed files with 32 additions and 18 deletions
|
|
@ -109,7 +109,11 @@ class BitcoinTwTransaction(BitcoinTwCommon):
|
|||
self.label = get_best_label()
|
||||
self.vsize = self.tx['decoded'].get('vsize') or self.tx['decoded']['size']
|
||||
self.txid = CoinTxID(self.tx['txid'])
|
||||
self.time = self.tx['time']
|
||||
# Though 'blocktime' is flagged as an “optional” field, it’s always present for transactions
|
||||
# that are in the blockchain. However, Bitcoin Core wallet saves a record of broadcast but
|
||||
# unconfirmed transactions, e.g. replaced transactions, and the 'blocktime' field is missing
|
||||
# for these, so use 'time' as a fallback.
|
||||
self.time = self.tx.get('blocktime') or self.tx['time']
|
||||
|
||||
def blockheight_disp(self,color):
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -362,4 +362,7 @@ if g.prog_name == 'mmgen-tool' and not opt._lock:
|
|||
if type(ret).__name__ == 'coroutine':
|
||||
ret = run_session(ret)
|
||||
|
||||
process_result(ret,pager='pager' in kwargs and kwargs['pager'],print_result=True)
|
||||
process_result(
|
||||
ret,
|
||||
pager = kwargs.get('pager'),
|
||||
print_result = True )
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ opts_data = {
|
|||
'usage2': [
|
||||
'[opts] create <xmr_keyaddrfile> [wallets]',
|
||||
'[opts] sync <xmr_keyaddrfile> [wallets]',
|
||||
'[opts] transfer <xmr_keyaddrfile> <transfer_spec>',
|
||||
'[opts] sweep <xmr_keyaddrfile> <sweep_spec>',
|
||||
'[opts] transfer <xmr_keyaddrfile> TRANSFER_SPEC',
|
||||
'[opts] sweep <xmr_keyaddrfile> SWEEP_SPEC',
|
||||
'[opts] relay <TX_file>',
|
||||
],
|
||||
'options': """
|
||||
|
|
@ -83,7 +83,7 @@ relay - relay a transaction from a transaction file created using 'sweep'
|
|||
or 'transfer' with the --do-not-relay option
|
||||
|
||||
|
||||
CREATE AND SYNC OPERATION NOTES
|
||||
'CREATE' AND 'SYNC' OPERATION NOTES
|
||||
|
||||
These operations take an optional `wallets` argument: one or more address
|
||||
indexes (expressed as a comma-separated list, hyphenated range, or both)
|
||||
|
|
@ -91,10 +91,9 @@ in the specified key-address file, each corresponding to a Monero wallet
|
|||
to be created or synced. If omitted, all wallets are operated upon.
|
||||
|
||||
|
||||
TRANSFER OPERATION NOTES
|
||||
'TRANSFER' OPERATION NOTES
|
||||
|
||||
The transfer operation takes a `transfer specifier` arg with the following
|
||||
format:
|
||||
The transfer operation takes a TRANSFER_SPEC arg with the following format:
|
||||
|
||||
SOURCE:ACCOUNT:ADDRESS,AMOUNT
|
||||
|
||||
|
|
@ -102,9 +101,9 @@ where SOURCE is a wallet number; ACCOUNT the source account index; and ADDRESS
|
|||
and AMOUNT the destination Monero address and XMR amount, respectively.
|
||||
|
||||
|
||||
SWEEP OPERATION NOTES
|
||||
'SWEEP' OPERATION NOTES
|
||||
|
||||
The sweep operation takes a `sweep specifier` arg with the following format:
|
||||
The sweep operation takes a SWEEP_SPEC arg with the following format:
|
||||
|
||||
SOURCE:ACCOUNT[,DEST]
|
||||
|
||||
|
|
@ -123,7 +122,7 @@ Note that multiple sweep operations may be required to sweep all the funds
|
|||
in an account.
|
||||
|
||||
|
||||
RELAY OPERATION NOTES
|
||||
'RELAY' OPERATION NOTES
|
||||
|
||||
By default, transactions are relayed to a monerod running on localhost at the
|
||||
default RPC port. To relay transactions to a remote or non-default monerod
|
||||
|
|
|
|||
15
mmgen/rpc.py
15
mmgen/rpc.py
|
|
@ -60,6 +60,13 @@ def dmsg_rpc(fs,data=None,is_json=False):
|
|||
fs.format(pp_fmt(json.loads(data) if is_json else data))
|
||||
)
|
||||
|
||||
def dmsg_rpc_backend(host_url,host_path,payload):
|
||||
if g.debug_rpc:
|
||||
msg(
|
||||
f'\n RPC URL: {host_url}{host_path}' +
|
||||
f'\n RPC PAYLOAD data (httplib) ==>' +
|
||||
f'\n{pp_fmt(payload)}\n' )
|
||||
|
||||
class IPPort(str,Hilite,InitErrors):
|
||||
color = 'yellow'
|
||||
width = 0
|
||||
|
|
@ -124,7 +131,7 @@ class RPCBackends:
|
|||
self.auth = None
|
||||
|
||||
async def run(self,payload,timeout,host_path):
|
||||
dmsg_rpc('\n RPC PAYLOAD data (aiohttp) ==>\n{}\n',payload)
|
||||
dmsg_rpc_backend(self.host_url,host_path,payload)
|
||||
async with self.session.post(
|
||||
url = self.host_url + host_path,
|
||||
auth = self.auth,
|
||||
|
|
@ -155,7 +162,7 @@ class RPCBackends:
|
|||
})
|
||||
|
||||
async def run(self,payload,timeout,host_path):
|
||||
dmsg_rpc('\n RPC PAYLOAD data (requests) ==>\n{}\n',payload)
|
||||
dmsg_rpc_backend(self.host_url,host_path,payload)
|
||||
res = self.session.post(
|
||||
url = self.host_url + host_path,
|
||||
data = json.dumps(payload,cls=json_encoder),
|
||||
|
|
@ -184,7 +191,7 @@ class RPCBackends:
|
|||
auth_str_b64 ))
|
||||
|
||||
async def run(self,payload,timeout,host_path):
|
||||
dmsg_rpc('\n RPC PAYLOAD data (httplib) ==>\n{}\n',payload)
|
||||
dmsg_rpc_backend(self.host_url,host_path,payload)
|
||||
|
||||
if timeout:
|
||||
import http.client
|
||||
|
|
@ -237,7 +244,7 @@ class RPCBackends:
|
|||
data = json.dumps(payload,cls=json_encoder)
|
||||
if len(data) > self.arg_max:
|
||||
return self.httplib(payload,timeout=timeout)
|
||||
dmsg_rpc('\n RPC PAYLOAD data (curl) ==>\n{}\n',payload)
|
||||
dmsg_rpc_backend(self.host_url,host_path,payload)
|
||||
exec_cmd = [
|
||||
'curl',
|
||||
'--proxy', f'socks5h://{self.proxy}' if self.proxy else '',
|
||||
|
|
|
|||
|
|
@ -64,9 +64,10 @@ def usage(cmdname=None,exit_val=1):
|
|||
m1 = """
|
||||
USAGE INFORMATION FOR MMGEN-TOOL COMMANDS:
|
||||
|
||||
Unquoted arguments are mandatory
|
||||
Quoted arguments are optional, default values will be used
|
||||
Argument types and default values are shown in square brackets
|
||||
Arguments with only type specified in square brackets are required
|
||||
|
||||
Arguments with both type and default value specified in square brackets are
|
||||
optional; if used, they must be supplied in the form ‘name=value’
|
||||
"""
|
||||
|
||||
m2 = """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue