Skip to content

Commit c07073d

Browse files
Merge dashpay#6445: test: add tests for listunspent with coinType option
f3be9bc test: add tests for `listunspent` with `coinType` option (UdjinM6) Pull request description: ## Issue being fixed or feature implemented extend tests a bit ## What was done? ## How Has This Been Tested? ## Breaking Changes ## Checklist: - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK f3be9bc Tree-SHA512: 3f063011224880fee35edb04ce265dff33a52273c3d45ef1dbcebcecb22c25d8ad7c91b83514f36142716a6fbd0ddd3a8a3f2a9b59ce78ce975bbce69a2a13b5
2 parents 5710036 + f3be9bc commit c07073d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/functional/wallet_basic.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
assert_array_result,
1313
assert_equal,
1414
assert_fee_amount,
15+
assert_greater_than,
1516
assert_raises_rpc_error,
1617
count_bytes,
1718
)
@@ -325,6 +326,33 @@ def run_test(self):
325326
assert_equal(uTx['amount'], Decimal('0'))
326327
assert found
327328

329+
self.log.info("Test listunspent with coinType option")
330+
# 0=ALL_COINS
331+
# 1=ONLY_FULLY_MIXED
332+
# 2=ONLY_READY_TO_MIX
333+
# 3=ONLY_NONDENOMINATED
334+
# 4=ONLY_MASTERNODE_COLLATERAL
335+
# 5=ONLY_COINJOIN_COLLATERAL
336+
assert_greater_than(self.nodes[1].getbalance(), 1001)
337+
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
338+
for cointype in range(6):
339+
len_cointype = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': cointype}))
340+
assert_equal(len_cointype, 0)
341+
address = self.nodes[0].getnewaddress()
342+
for amount in {0.00100001, 0.00100000, 1000, 0.00010000}:
343+
self.nodes[1].sendtoaddress(address=address, amount=amount)
344+
self.sync_mempools(self.nodes[0:2])
345+
for cointype in range(2, 6):
346+
len_cointype = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': cointype}))
347+
assert_equal(len_cointype, 2 if cointype == 3 else 1) # masternode collaterals are counted as ONLY_NONDENOMINATED too
348+
len_default = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True))
349+
len0 = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': 0}))
350+
len1 = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': 1}))
351+
assert_equal(len_default, len0)
352+
assert_equal(len0, 4)
353+
assert_equal(len1, 0)
354+
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
355+
328356
self.log.info("Test -walletbroadcast")
329357
self.stop_nodes()
330358
self.start_node(0, ["-walletbroadcast=0"])

0 commit comments

Comments
 (0)