Merge #6320: test: adjust reindex test to check with txindex on/off

251434f094 test: adjust reindex test to check with txindex on/off (UdjinM6)

Pull request description:

  ## Issue being fixed or feature implemented
  https://github.com/dashpay/dash/pull/6316#discussion_r1791520650

  ## 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
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  kwvg:
    utACK 251434f094
  PastaPastaPasta:
    utACK 251434f094

Tree-SHA512: c2349317c7e1f1202c3f141bc4271b45b4a1d69740681ec1aacd0ebb20082db0255c4a9eb0562c01f9229bd119e6bcc7b87964da3b4d7e23aa855d04e75c3880
This commit is contained in:
pasta 2024-10-08 09:12:50 -05:00
commit 6ee5f2dc27
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38

View File

@ -18,20 +18,21 @@ class ReindexTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def reindex(self, justchainstate=False): def reindex(self, justchainstate=False, txindex=0):
self.generatetoaddress(self.nodes[0], 3, self.nodes[0].get_deterministic_priv_key().address) self.generatetoaddress(self.nodes[0], 3, self.nodes[0].get_deterministic_priv_key().address)
blockcount = self.nodes[0].getblockcount() blockcount = self.nodes[0].getblockcount()
self.stop_nodes() self.stop_nodes()
extra_args = [["-reindex-chainstate" if justchainstate else "-reindex", "-txindex=0"]] extra_args = [["-reindex-chainstate", "-txindex=0"]] if justchainstate else [["-reindex", f"-txindex={txindex}"]]
self.start_nodes(extra_args) self.start_nodes(extra_args)
assert_equal(self.nodes[0].getblockcount(), blockcount) # start_node is blocking on reindex assert_equal(self.nodes[0].getblockcount(), blockcount) # start_node is blocking on reindex
self.log.info("Success") self.log.info("Success")
def run_test(self): def run_test(self):
self.reindex(False) for txindex in [0, 1]:
self.reindex(True) self.reindex(False, txindex)
self.reindex(False) self.reindex(True, txindex)
self.reindex(True) self.reindex(False, txindex)
self.reindex(True, txindex)
if __name__ == '__main__': if __name__ == '__main__':
ReindexTest().main() ReindexTest().main()