aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-08-10 21:31:06 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-08-10 21:31:08 -0400
commit09ada21ca282d3e252cf2203cd227860488547ba (patch)
tree1bd403e0adb185ae8d16dc96eaf960ba5bc25493 /test
parent48bf8ff5b161e77079bf00a7a452b3f2fe511f84 (diff)
parent1f87c372b521a1ff6970aca9df0ded839528ea20 (diff)
Merge #13924: tests: Simplify comparison in rpc_blockchain.py
1f87c372b5 Simplify comparison in rpc_blockchain.py. (Daniel Kraft) Pull request description: The test for `gettxoutsetinfo` in `rpc_blockchain.py` verifies that the result is the same as before after invalidating and reconsidering a block. The comparison has to exclude the `disk_size` field, though, as it is not deterministic. Instead of comparing all the other fields for equality, this change explicitly removes the `disk_size` field and then compares the full objects. This makes the intent more explicit (compare everything except for `disk_size`, not compare just a given list of fields) and also the code simpler. Tree-SHA512: 3c376a8836b62988fb2f0117c9ca65de64a33bf3cd4980a123de30bf5e7b7a48eda477b25e03d672ff076e205c698e83432469156caa0f0f3ebbb0480f0dd77d
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_blockchain.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
index 49f44b0c6d..d681cdc8ab 100755
--- a/test/functional/rpc_blockchain.py
+++ b/test/functional/rpc_blockchain.py
@@ -194,13 +194,10 @@ class BlockchainTest(BitcoinTestFramework):
node.reconsiderblock(b1hash)
res3 = node.gettxoutsetinfo()
- assert_equal(res['total_amount'], res3['total_amount'])
- assert_equal(res['transactions'], res3['transactions'])
- assert_equal(res['height'], res3['height'])
- assert_equal(res['txouts'], res3['txouts'])
- assert_equal(res['bogosize'], res3['bogosize'])
- assert_equal(res['bestblock'], res3['bestblock'])
- assert_equal(res['hash_serialized_2'], res3['hash_serialized_2'])
+ # The field 'disk_size' is non-deterministic and can thus not be
+ # compared between res and res3. Everything else should be the same.
+ del res['disk_size'], res3['disk_size']
+ assert_equal(res, res3)
def _test_getblockheader(self):
node = self.nodes[0]