• R/O
  • HTTP
  • SSH
  • HTTPS

bytom-spanner: Commit

Python based Bytom wallet tools


Commit MetaInfo

Revision115bf7884dabe62bac4845e9688e22ddd6f8db4f (tree)
Zeit2018-06-26 18:43:33
Autorsuccessli <successli@outl...>
Commitersuccessli

Log Message

refactor(merge_utxo.py): delete time delay and input check.

Ändern Zusammenfassung

Diff

--- a/utxomerger/merge_utxo.py
+++ b/utxomerger/merge_utxo.py
@@ -88,10 +88,6 @@ def main():
8888 utxo_total = []
8989 utxolist = list_utxo(options.url, options.account_alias, options.min_amount, options.max_amount)
9090
91- if (options.merge_list * options.for_loop) > len(utxolist):
92- print('input size is too large, please check it later.')
93- return
94-
9591 for i, utxo in enumerate(utxolist):
9692 print('{:4}. {:13.8f} BTM {}{}'.format(i, utxo['amount'] / 1e8, utxo['id'], ' (mature)'))
9793 if i >= options.merge_list * options.for_loop:
@@ -104,13 +100,11 @@ def main():
104100 return
105101
106102 print('To merge {} UTXOs with {:13.8f} BTM totally.\n'.format(len(utxo_total),
107- sum(utxo['amount'] for utxo in utxo_total) / 1e8))
103+ sum(utxo['amount'] for utxo in utxo_total) / 1e8))
108104
109105 merge_size = options.merge_list or input('Merge size of UTXOs (5, 13 or 20): ')
110106 for_loop = options.for_loop or input('for loop size (1, 10 or 50): ')
111107
112-
113-
114108 print(
115109 'One last disclaimer: the code we are about to go over is in no way intended to be used as an example of a robust solution. ')
116110 print('You will transfer BTM to an address, please check this python code and DO IT later.\n')
@@ -120,15 +114,17 @@ def main():
120114 utxo_mergelist = []
121115
122116 # for i in range(merge_size if merge_size <= len(utxolist) else len(utxolist)):
123- # utxo_mergelist.append(utxolist[i])
124- for i in range(loops*merge_size, ((loops+1)*merge_size) if (loops*merge_size) < len(utxolist) else len(utxolist)):
117+ # utxo_mergelist.append(utxolist[i])
118+ for i in range(loops * merge_size,
119+ ((loops + 1) * merge_size) if (loops * merge_size) < len(utxolist) else len(utxolist)):
125120 utxo_mergelist.append(utxolist[i])
126121
127122 # print(loops*merge_size, ", ", ((loops+1)*merge_size) if (loops*merge_size) < len(utxolist) else len(utxolist))
128- print('this is the {} times to merge utxos. -----begin'.format(loops+1))
123+ print('this is the {} times to merge utxos. -----begin'.format(loops + 1))
129124
130125 for i, utxo in enumerate(utxo_mergelist):
131- print('{:4}. {:13.8f} BTM {}{}'.format(loops*merge_size+i, utxo['amount'] / 1e8, utxo['id'], ' (mature)'))
126+ print(
127+ '{:4}. {:13.8f} BTM {}{}'.format(loops * merge_size + i, utxo['amount'] / 1e8, utxo['id'], ' (mature)'))
132128
133129 print("total size of available utxos is {}".format(len(utxo_mergelist)))
134130
@@ -154,11 +150,7 @@ def main():
154150 to_address = input('Transfer address: ')
155151
156152 print('tx_id:', send_tx(Connection(options.url), utxo_mergelist, to_address, options.password))
157- print('this is the {} times to merge utxos. -----end\n'.format(loops+1))
158-
159-
160- time.sleep(2)
161- pass
153+ print('this is the {} times to merge utxos. -----end\n'.format(loops + 1))
162154
163155
164156 if __name__ == '__main__':
Show on old repository browser