Browse Source

mmgen-tool txhist: sort transaction inputs deterministically

The MMGen Project 2 years ago
parent
commit
b1096f5a14
2 changed files with 8 additions and 2 deletions
  1. 1 1
      mmgen/data/version
  2. 7 1
      mmgen/proto/btc/tw/txhistory.py

+ 1 - 1
mmgen/data/version

@@ -1 +1 @@
-13.3.dev14
+13.3.dev15

+ 7 - 1
mmgen/proto/btc/tw/txhistory.py

@@ -66,7 +66,13 @@ class BitcoinTwTransaction(BitcoinTwCommon):
 						data = d.data )
 			return sorted(
 				gen(),
-				key = lambda d: d.twlabel.twmmid.sort_key if d.twlabel else 'zz_' + d.coin_addr )
+				# if address is not MMGen, ignore address and sort by TxID + vout only
+				key = lambda d: (
+					(d.twlabel.twmmid.sort_key if d.twlabel and d.twlabel.twmmid.type == 'mmgen' else '')
+					+ '_'
+					+ d.txid
+					+ '{:08d}'.format(d.data['n'])
+				))
 
 		def gen_all_addrs(src):
 			for e in self.vouts_info[src]: