-
Notifications
You must be signed in to change notification settings - Fork 20
Purge reorg transactions #81
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
history = responses['history'] | ||
if 'transaction' in responses: | ||
transaction = responses['transaction'] | ||
MockNetwork.__init__(self, history, transaction) |
There was a problem hiding this comment.
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) | ||
) | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:' | ||
) |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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} | ||
) |
There was a problem hiding this comment.
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
)
torba/client/basedatabase.py
Outdated
# 2. update address histories removing deleted TXs | ||
return True | ||
addrhis = await self.select_addresses('address, history') |
There was a problem hiding this comment.
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
?
Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
No description provided.