Skip to content

Commit

Permalink
Merge #6445: test: add tests for listunspent with coinType option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
PastaPastaPasta committed Dec 11, 2024
2 parents 5710036 + f3be9bc commit c07073d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
assert_array_result,
assert_equal,
assert_fee_amount,
assert_greater_than,
assert_raises_rpc_error,
count_bytes,
)
Expand Down Expand Up @@ -325,6 +326,33 @@ def run_test(self):
assert_equal(uTx['amount'], Decimal('0'))
assert found

self.log.info("Test listunspent with coinType option")
# 0=ALL_COINS
# 1=ONLY_FULLY_MIXED
# 2=ONLY_READY_TO_MIX
# 3=ONLY_NONDENOMINATED
# 4=ONLY_MASTERNODE_COLLATERAL
# 5=ONLY_COINJOIN_COLLATERAL
assert_greater_than(self.nodes[1].getbalance(), 1001)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
for cointype in range(6):
len_cointype = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': cointype}))
assert_equal(len_cointype, 0)
address = self.nodes[0].getnewaddress()
for amount in {0.00100001, 0.00100000, 1000, 0.00010000}:
self.nodes[1].sendtoaddress(address=address, amount=amount)
self.sync_mempools(self.nodes[0:2])
for cointype in range(2, 6):
len_cointype = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': cointype}))
assert_equal(len_cointype, 2 if cointype == 3 else 1) # masternode collaterals are counted as ONLY_NONDENOMINATED too
len_default = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True))
len0 = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': 0}))
len1 = len(self.nodes[0].listunspent(minconf=0, maxconf=0, include_unsafe=True, query_options={'coinType': 1}))
assert_equal(len_default, len0)
assert_equal(len0, 4)
assert_equal(len1, 0)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)

self.log.info("Test -walletbroadcast")
self.stop_nodes()
self.start_node(0, ["-walletbroadcast=0"])
Expand Down

0 comments on commit c07073d

Please sign in to comment.