aboutsummaryrefslogtreecommitdiff
path: root/tests/functional_tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-03 17:18:15 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-09-17 11:38:27 +0000
commitc148002534540917f08d044dde12053b7627c308 (patch)
tree21c1e17ac5fbdb4c87efccd17ccd0b9a2abd9a7f /tests/functional_tests
parentfunctional_tests: check transaction fee is around what we expect (diff)
downloadmonero-c148002534540917f08d044dde12053b7627c308.tar.xz
functional_tests: add submitblock test
Diffstat (limited to 'tests/functional_tests')
-rwxr-xr-xtests/functional_tests/mining.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py
index b8b9e0959..360f2763d 100755
--- a/tests/functional_tests/mining.py
+++ b/tests/functional_tests/mining.py
@@ -48,6 +48,7 @@ class MiningTest():
self.create()
self.mine(True)
self.mine(False)
+ self.submitblock()
def reset(self):
print('Resetting blockchain')
@@ -140,6 +141,33 @@ class MiningTest():
res_status = daemon.mining_status()
assert res_status.active == False
+ def submitblock(self):
+ print "Test submitblock"
+
+ daemon = Daemon()
+ res = daemon.get_height()
+ height = res.height
+ res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 5)
+ assert len(res.blocks) == 5
+ hashes = res.blocks
+ blocks = []
+ for block_hash in hashes:
+ res = daemon.getblock(hash = block_hash)
+ assert len(res.blob) > 0 and len(res.blob) % 2 == 0
+ blocks.append(res.blob)
+ res = daemon.get_height()
+ assert res.height == height + 5
+ res = daemon.pop_blocks(5)
+ res = daemon.get_height()
+ assert res.height == height
+ for i in range(len(hashes)):
+ block_hash = hashes[i]
+ assert len(block_hash) == 64
+ res = daemon.submitblock(blocks[i])
+ res = daemon.get_height()
+ assert res.height == height + i + 1
+ assert res.hash == block_hash
+
if __name__ == '__main__':
MiningTest().run_test()