make block_expected public

This commit is contained in:
Victor Shyba 2019-12-20 13:04:21 -03:00 committed by Lex Berezhny
parent b1c5655138
commit 757fb51415
3 changed files with 5 additions and 5 deletions

View file

@ -223,7 +223,7 @@ class CommandTestCase(IntegrationTestCase):
if confirm: if confirm:
await self.ledger.wait(tx) await self.ledger.wait(tx)
await self.generate(1) await self.generate(1)
await self.ledger.wait(tx, self.blockchain._block_expected) await self.ledger.wait(tx, self.blockchain.block_expected)
return self.sout(tx) return self.sout(tx)
def create_upload_file(self, data, prefix=None, suffix=None): def create_upload_file(self, data, prefix=None, suffix=None):

View file

@ -265,7 +265,7 @@ class ResolveAfterReorg(BaseResolveTestCase):
async def reorg(self, start): async def reorg(self, start):
blocks = self.ledger.headers.height - start blocks = self.ledger.headers.height - start
self.blockchain._block_expected = start - 1 self.blockchain.block_expected = start - 1
# go back to start # go back to start
await self.blockchain.invalidate_block(self.ledger.headers.hash(start).decode()) await self.blockchain.invalidate_block(self.ledger.headers.hash(start).decode())
# go to previous + 1 # go to previous + 1

View file

@ -281,7 +281,7 @@ class BlockchainNode:
self.data_path = None self.data_path = None
self.protocol = None self.protocol = None
self.transport = None self.transport = None
self._block_expected = 0 self.block_expected = 0
self.hostname = 'localhost' self.hostname = 'localhost'
self.peerport = 9246 + 2 # avoid conflict with default peer port self.peerport = 9246 + 2 # avoid conflict with default peer port
self.rpcport = 9245 + 2 # avoid conflict with default rpc port self.rpcport = 9245 + 2 # avoid conflict with default rpc port
@ -294,7 +294,7 @@ class BlockchainNode:
return f'http://{self.rpcuser}:{self.rpcpassword}@{self.hostname}:{self.rpcport}/' return f'http://{self.rpcuser}:{self.rpcpassword}@{self.hostname}:{self.rpcport}/'
def is_expected_block(self, e: BlockHeightEvent): def is_expected_block(self, e: BlockHeightEvent):
return self._block_expected == e.height return self.block_expected == e.height
@property @property
def exists(self): def exists(self):
@ -383,7 +383,7 @@ class BlockchainNode:
return out.decode().strip() return out.decode().strip()
def generate(self, blocks): def generate(self, blocks):
self._block_expected += blocks self.block_expected += blocks
return self._cli_cmnd('generate', str(blocks)) return self._cli_cmnd('generate', str(blocks))
def invalidate_block(self, blockhash): def invalidate_block(self, blockhash):