1717from io import BytesIO
1818from test_framework .messages import CTransaction , ToHex
1919from test_framework .test_framework import BitcoinTestFramework
20- from test_framework .util import assert_equal , assert_raises_rpc_error , bytes_to_hex_str , connect_nodes_bi , hex_str_to_bytes
20+ from test_framework .util import assert_equal , assert_raises_rpc_error , bytes_to_hex_str , connect_nodes_bi , hex_str_to_bytes , BITCOIN_ASSET
2121
2222class multidict (dict ):
2323 """Dictionary that allows duplicate keys.
@@ -253,18 +253,18 @@ def run_test(self):
253253 mSigObj = self .nodes [2 ].addmultisigaddress (2 , [addr1Obj ['pubkey' ], addr1 ])['address' ]
254254
255255 #use balance deltas instead of absolute values
256- bal = self .nodes [2 ].getbalance ()
256+ bal = self .nodes [2 ].getbalance ('*' , 0 , False , BITCOIN_ASSET )
257257
258258 # send 1.2 BTC to msig adr
259259 txId = self .nodes [0 ].sendtoaddress (mSigObj , 1.2 )
260260 self .sync_all ()
261261 self .nodes [0 ].generate (1 )
262262 self .sync_all ()
263- assert_equal (self .nodes [2 ].getbalance (), bal + Decimal ('1.20000000' )) #node2 has both keys of the 2of2 ms addr., tx should affect the balance
263+ assert_equal (self .nodes [2 ].getbalance ('*' , 0 , False , BITCOIN_ASSET ), bal + Decimal ('1.20000000' )) #node2 has both keys of the 2of2 ms addr., tx should affect the balance
264264
265265
266266 # 2of3 test from different nodes
267- bal = self .nodes [2 ].getbalance ()
267+ bal = self .nodes [2 ].getbalance ('*' , 0 , False , BITCOIN_ASSET )
268268 addr1 = self .nodes [1 ].getnewaddress ()
269269 addr2 = self .nodes [2 ].getnewaddress ()
270270 addr3 = self .nodes [2 ].getnewaddress ()
@@ -284,7 +284,7 @@ def run_test(self):
284284
285285 #THIS IS AN INCOMPLETE FEATURE
286286 #NODE2 HAS TWO OF THREE KEY AND THE FUNDS SHOULD BE SPENDABLE AND COUNT AT BALANCE CALCULATION
287- assert_equal (self .nodes [2 ].getbalance (), bal ) #for now, assume the funds of a 2of3 multisig tx are not marked as spendable
287+ assert_equal (self .nodes [2 ].getbalance ('*' , 0 , False , BITCOIN_ASSET ), bal ) #for now, assume the funds of a 2of3 multisig tx are not marked as spendable
288288
289289 txDetails = self .nodes [0 ].gettransaction (txId , True )
290290 rawTx = self .nodes [0 ].decoderawtransaction (txDetails ['hex' ])
@@ -294,7 +294,7 @@ def run_test(self):
294294 vout = outpoint
295295 break
296296
297- bal = self .nodes [0 ].getbalance ()
297+ bal = self .nodes [0 ].getbalance ('*' , 0 , False , BITCOIN_ASSET )
298298 inputs = [{ "txid" : txId , "vout" : vout ['n' ], "scriptPubKey" : vout ['scriptPubKey' ]['hex' ], "amount" : vout ['value' ]}]
299299 outputs = { self .nodes [0 ].getnewaddress () : 2.19 }
300300 rawTx = self .nodes [2 ].createrawtransaction (inputs , outputs )
@@ -308,10 +308,10 @@ def run_test(self):
308308 self .sync_all ()
309309 self .nodes [0 ].generate (1 )
310310 self .sync_all ()
311- assert_equal (self .nodes [0 ].getbalance (), bal + Decimal ('50.00000000' )+ Decimal ('2.19000000' )) #block reward + tx
311+ assert_equal (self .nodes [0 ].getbalance ('*' , 0 , False , BITCOIN_ASSET ), bal + Decimal ('50.00000000' )+ Decimal ('2.19000000' )) #block reward + tx
312312
313313 # 2of2 test for combining transactions
314- bal = self .nodes [2 ].getbalance ()
314+ bal = self .nodes [2 ].getbalance ('*' , 0 , False , BITCOIN_ASSET )
315315 addr1 = self .nodes [1 ].getnewaddress ()
316316 addr2 = self .nodes [2 ].getnewaddress ()
317317
@@ -329,7 +329,7 @@ def run_test(self):
329329 self .nodes [0 ].generate (1 )
330330 self .sync_all ()
331331
332- assert_equal (self .nodes [2 ].getbalance (), bal ) # the funds of a 2of2 multisig tx should not be marked as spendable
332+ assert_equal (self .nodes [2 ].getbalance ('*' , 0 , False , BITCOIN_ASSET ), bal ) # the funds of a 2of2 multisig tx should not be marked as spendable
333333
334334 txDetails = self .nodes [0 ].gettransaction (txId , True )
335335 rawTx2 = self .nodes [0 ].decoderawtransaction (txDetails ['hex' ])
@@ -339,7 +339,7 @@ def run_test(self):
339339 vout = outpoint
340340 break
341341
342- bal = self .nodes [0 ].getbalance ()
342+ bal = self .nodes [0 ].getbalance ('*' , 0 , False , BITCOIN_ASSET )
343343 inputs = [{ "txid" : txId , "vout" : vout ['n' ], "scriptPubKey" : vout ['scriptPubKey' ]['hex' ], "redeemScript" : mSigObjValid ['hex' ], "amount" : vout ['value' ]}]
344344 outputs = { self .nodes [0 ].getnewaddress () : 2.19 }
345345 rawTx2 = self .nodes [2 ].createrawtransaction (inputs , outputs )
@@ -357,7 +357,7 @@ def run_test(self):
357357 self .sync_all ()
358358 self .nodes [0 ].generate (1 )
359359 self .sync_all ()
360- assert_equal (self .nodes [0 ].getbalance (), bal + Decimal ('50.00000000' )+ Decimal ('2.19000000' )) #block reward + tx
360+ assert_equal (self .nodes [0 ].getbalance ('*' , 0 , False , BITCOIN_ASSET ), bal + Decimal ('50.00000000' )+ Decimal ('2.19000000' )) #block reward + tx
361361
362362 # decoderawtransaction tests
363363 # witness transaction
0 commit comments