@@ -15,15 +15,19 @@ def print_balance(mn_config, have_unconfirmed_tx):
1515
1616 need_wallet_rescan = False
1717
18- print ('[masternodes balance]' )
18+ print ('\n [masternodes balance]' )
1919 print ('alias\t cnt\t spn\t balance\t \t address to send MN earnings' )
2020
21+ total_balance = 0
22+
2123 for m in mn_config :
2224 alias = m .get ('alias' )
2325 unspent = m .get ('collateral_dashd_balance' )
2426 sumofunspent = sum (unspent )
2527 cnt = len (unspent )
2628
29+ total_balance = total_balance + sumofunspent
30+
2731 spn = 0
2832 txs_spn = m .get ('txs' )
2933
@@ -49,6 +53,8 @@ def print_balance(mn_config, have_unconfirmed_tx):
4953 '\t ' +
5054 str (m .get ('receiving_address' , '----' )))
5155
56+ print ('\n \t \t Total : ' , total_balance )
57+
5258 print ('\n * cnt - count : number of payouts(un + mature) + 1(collateral)' )
5359 print ('* spn - spenable : number of spendable payouts(mature)' )
5460 if have_unconfirmed_tx :
@@ -78,6 +84,7 @@ def get_unspent_txs(mnconfig, blockcount, access, SEND_TO_BIP32, bip32_unused):
7884
7985 collateral_address = mnconfig .get ('collateral_address' )
8086 collateral_txidtxidn = mnconfig .get ('collateral_txidtxidn' )
87+ receiving_address = mnconfig .get ('receiving_address' )
8188
8289 unspent_cache_abs_path = os .path .join (
8390 os .path .dirname (
@@ -124,9 +131,15 @@ def get_unspent_txs(mnconfig, blockcount, access, SEND_TO_BIP32, bip32_unused):
124131 # for testing
125132 #mature_confirmation = 10
126133
134+ desc_displayed = False
135+
127136 for x in unspent_mine :
128137 if (x .get ('address' ) == collateral_address ) and ((blockcount - mature_confirmation ) > x .get ('height' )):
129- if SEND_TO_BIP32 and bip32_unused != None :
138+ if SEND_TO_BIP32 and bip32_unused != None and receiving_address == 'BIP32_PATH' :
139+ if not desc_displayed :
140+ print ("\t ---> getting unused addresses of bip32 path" )
141+ desc_displayed = True
142+
130143 bip32sendto_unused = bip32_unused .__next__ ()
131144 tx = {
132145 "amount" : round (Decimal (float (x .get ('satoshis' ) / 1e8 )), 8 ),
@@ -147,7 +160,7 @@ def get_unspent_txs(mnconfig, blockcount, access, SEND_TO_BIP32, bip32_unused):
147160
148161 txs .append (tx )
149162
150- if SEND_TO_BIP32 and bip32_unused != None :
163+ if SEND_TO_BIP32 and bip32_unused != None and receiving_address == 'BIP32_PATH' :
151164 sublist = [txs [i :i + 1 ] for i in range (0 , len (txs ), 1 )]
152165
153166 else :
@@ -232,11 +245,15 @@ def make_inputs_for_hw_wallet(
232245 if txsizefee == 0 :
233246 txsizefee = min_fee
234247
248+ # bip32 1 input tx
249+ if SEND_TO_BIP32 and receiving_address == 'BIP32_PATH' :
250+ txsizefee = 2500
251+
235252 # make output based on inputs
236- if SEND_TO_BIP32 :
253+ if SEND_TO_BIP32 and receiving_address == 'BIP32_PATH' :
237254 if len (tx ) == 1 :
238255 bip32sendto = tx [0 ].get ('bip32sendto' , None )
239- if bip32sendto != None :
256+ if bip32sendto != None and receiving_address == 'BIP32_PATH' :
240257 outputs .append (
241258 proto_types .TxOutputType (
242259 address = bip32sendto ,
@@ -275,8 +292,8 @@ def make_inputs_for_hw_wallet(
275292 script_type = proto_types .PAYTOADDRESS ,
276293 ))
277294
278- feetohuman = round (Decimal (txsizefee / 1e8 ), 4 )
279- if SEND_TO_BIP32 :
295+ feetohuman = round (Decimal (txsizefee / 1e8 ), 6 )
296+ if SEND_TO_BIP32 and receiving_address == 'BIP32_PATH' :
280297 print ('\n \t send %s\n \t %s txs to %s\n \t with fee of %s\n \t total amount : %s\n ' % (
281298 amount_total - feetohuman , len (tx ), bip32sendto , feetohuman , amount_total ))
282299
0 commit comments