mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-26 17:32:33 +00:00
functional_tests: add submitblock test
This commit is contained in:
parent
121c1b9475
commit
c148002534
1 changed files with 28 additions and 0 deletions
|
@ -48,6 +48,7 @@ class MiningTest():
|
||||||
self.create()
|
self.create()
|
||||||
self.mine(True)
|
self.mine(True)
|
||||||
self.mine(False)
|
self.mine(False)
|
||||||
|
self.submitblock()
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
print('Resetting blockchain')
|
print('Resetting blockchain')
|
||||||
|
@ -140,6 +141,33 @@ class MiningTest():
|
||||||
res_status = daemon.mining_status()
|
res_status = daemon.mining_status()
|
||||||
assert res_status.active == False
|
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__':
|
if __name__ == '__main__':
|
||||||
MiningTest().run_test()
|
MiningTest().run_test()
|
||||||
|
|
Loading…
Reference in a new issue