Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. diff --git a/qa/rpc-tests/invalidtxrequest.py b/qa/rpc-tests/invalidtxrequest.py
  2. index 26ca2f6..9fe6db4 100755
  3. --- a/qa/rpc-tests/invalidtxrequest.py
  4. +++ b/qa/rpc-tests/invalidtxrequest.py
  5. @@ -15,6 +15,8 @@ import time
  6. In this test we connect to one node over p2p, and test tx requests.
  7. '''
  8.  
  9. +FORKHEIGHT=100 # to analyse fork interference
  10. +
  11. # Use the ComparisonTestFramework with 1 node: only use --testbinary.
  12. class InvalidTxRequestTest(ComparisonTestFramework):
  13.  
  14. @@ -29,7 +31,7 @@ class InvalidTxRequestTest(ComparisonTestFramework):
  15. # for now, set the forkheight to workaround this interference.
  16. def setup_network(self):
  17. self.nodes = start_nodes(1, self.options.tmpdir,
  18. - extra_args=[['-debug', '-whitelist=127.0.0.1', ]],
  19. + extra_args=[['-forkheight=%s' % FORKHEIGHT, '-debug', '-whitelist=127.0.0.1', ]],
  20. binary=[self.options.testbinary])
  21. # MVF-Core end
  22.  
  23. @@ -64,7 +66,8 @@ class InvalidTxRequestTest(ComparisonTestFramework):
  24. '''
  25. test = TestInstance(sync_every_block=False)
  26. for i in xrange(100):
  27. - block = create_block(self.tip, create_coinbase(height), self.block_time)
  28. + nbits = 0x207eeeee if i == (FORKHEIGHT-1) else 0x207fffff
  29. + block = create_block(self.tip, create_coinbase(height), self.block_time, nbits)
  30. block.solve()
  31. self.tip = block.sha256
  32. self.block_time += 1
  33. diff --git a/qa/rpc-tests/test_framework/blocktools.py b/qa/rpc-tests/test_framework/blocktools.py
  34. index 88f553a..ef8b54d 100644
  35. --- a/qa/rpc-tests/test_framework/blocktools.py
  36. +++ b/qa/rpc-tests/test_framework/blocktools.py
  37. @@ -8,7 +8,7 @@ from mininode import *
  38. from script import CScript, OP_TRUE, OP_CHECKSIG
  39.  
  40. # Create a block (with regtest difficulty)
  41. -def create_block(hashprev, coinbase, nTime=None):
  42. +def create_block(hashprev, coinbase, nTime=None, nbits=0x207fffff):
  43. block = CBlock()
  44. if nTime is None:
  45. import time
  46. @@ -16,7 +16,7 @@ def create_block(hashprev, coinbase, nTime=None):
  47. else:
  48. block.nTime = nTime
  49. block.hashPrevBlock = hashprev
  50. - block.nBits = 0x207fffff # Will break after a difficulty adjustment...
  51. + block.nBits = nbits # default will break after a difficulty adjustment...
  52. block.vtx.append(coinbase)
  53. block.hashMerkleRoot = block.calc_merkle_root()
  54. block.calc_sha256()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement