Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 31, 2019. It is now read-only.

Conversation

@bvbfan
Copy link

@bvbfan bvbfan commented May 8, 2019

No description provided.

bvbfan added 2 commits May 8, 2019 16:16
Signed-off-by: Anthony Fieroni <[email protected]>
Signed-off-by: Anthony Fieroni <[email protected]>
Signed-off-by: Anthony Fieroni <[email protected]>
Signed-off-by: Anthony Fieroni <[email protected]>
@codecov
Copy link

codecov bot commented May 9, 2019

Codecov Report

Merging #81 into master will increase coverage by 0.1%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #81     +/-   ##
=========================================
+ Coverage   69.15%   69.26%   +0.1%     
=========================================
  Files          65       65             
  Lines       10416    10456     +40     
=========================================
+ Hits         7203     7242     +39     
- Misses       3213     3214      +1
Impacted Files Coverage Ξ”
torba/client/basedatabase.py 98.78% <91.66%> (-0.18%) ⬇️
torba/client/baseledger.py 95.19% <0%> (-0.33%) ⬇️
torba/server/daemon.py 53.15% <0%> (+0.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update a54a11d...10977c0. Read the comment docs.

history = responses['history']
if 'transaction' in responses:
transaction = responses['transaction']
MockNetwork.__init__(self, history, transaction)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can replace all of that with just:
super().__init__(self, responses.get('history', ''), responses.get('transaction', '')

await self.db.execute(
*query("DELETE FROM {}".format(table), **constraints)
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, see the other methods. _*_sql is supposed to return SQL not, execute it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not wrong, other functions need one level abstraction in plus, here it's pointless.

self.assertEqual(
address_details['history'],
'252bda9b22cc902ca2aa2de3548ee8baf06b8501ff7bfb3b0b7d980dbd1bf792:20:'
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test should use self.ledger.receive_header() instead of self.ledger.db.rewind_blockchain()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By calling rewind_blockchain i ensure that it done work that it should, also calling receive_header does not trigger reorg thus rewind_blockchain is not called.

# 1. delete transactions above_height
txs = await self.select_transactions(
'txid, raw', None, **{'height__gte': above_height}
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        txs = await self.select_transactions(
            'txid, raw', height__gte=above_height
        )

await self._delete_sql('tx', **{'height__gte': above_height})
# 2. update address histories removing deleted TXs
return True
addrhis = await self.select_addresses('address, history')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's addrhis? maybe address_history?

@lbry-bot lbry-bot assigned bvbfan and unassigned bvbfan May 13, 2019
Signed-off-by: Anthony Fieroni <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants