TwView: improve sort keys for deterministic output
This commit is contained in:
parent
00484cd7ba
commit
54d68ab33f
4 changed files with 14 additions and 5 deletions
|
|
@ -120,6 +120,7 @@ class BitcoinTwTransaction:
|
|||
# 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']
|
||||
self.time_received = self.tx.get('timereceived')
|
||||
|
||||
def blockheight_disp(self,color):
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -16,6 +16,14 @@ from ....tw.view import TwView
|
|||
|
||||
class EthereumTwView(TwView):
|
||||
|
||||
sort_funcs = {
|
||||
'addr': lambda i: i.addr,
|
||||
'age': lambda i: 0 - i.confs,
|
||||
'amt': lambda i: i.amt,
|
||||
'txid': lambda i: f'{i.txid} {i.vout:04}',
|
||||
'twmmid': lambda i: i.twmmid.sort_key
|
||||
}
|
||||
|
||||
def age_disp(self,o,age_fmt): # TODO
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class TwTxHistory(TwView):
|
|||
}
|
||||
|
||||
sort_funcs = {
|
||||
'age': lambda i: i.time,
|
||||
'age': lambda i: '{:010}.{:010}'.format(0xffffffff - abs(i.confirmations), i.time_received or 0),
|
||||
'blockheight': lambda i: 0 - abs(i.confirmations), # old/altcoin daemons return no 'blockheight' field
|
||||
'amt': lambda i: i.wallet_outputs_total,
|
||||
'total_amt': lambda i: i.outputs_total,
|
||||
|
|
|
|||
|
|
@ -232,11 +232,11 @@ class TwView(MMGenObject,metaclass=AsyncInit):
|
|||
}
|
||||
|
||||
sort_funcs = {
|
||||
'addr': lambda i: i.addr,
|
||||
'age': lambda i: 0 - i.confs,
|
||||
'amt': lambda i: i.amt,
|
||||
'addr': lambda i: '{} {:010} {:024.12f}'.format(i.addr, 0xffffffff - abs(i.confs), i.amt),
|
||||
'age': lambda i: '{:010} {:024.12f}'.format(0xffffffff - abs(i.confs), i.amt),
|
||||
'amt': lambda i: '{:024.12f} {:010} {}'.format(i.amt, 0xffffffff - abs(i.confs), i.addr),
|
||||
'txid': lambda i: f'{i.txid} {i.vout:04}',
|
||||
'twmmid': lambda i: i.twmmid.sort_key
|
||||
'twmmid': lambda i: '{} {:010} {:024.12f}'.format(i.twmmid.sort_key, 0xffffffff - abs(i.confs), i.amt)
|
||||
}
|
||||
|
||||
def sort_info(self,include_group=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue