-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(gui): avoid KeyError in QELnPaymentDetails.update when key missing issue:#10116 #10118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,17 +95,20 @@ def update(self): | |
| self._logger.error('wallet undefined') | ||
| return | ||
|
|
||
| # TODO this is horribly inefficient. need a payment getter/query method | ||
| tx = self._wallet.wallet.lnworker.get_lightning_history()[self._key] | ||
| self._logger.debug(str(tx)) | ||
| history = self._wallet.wallet.lnworker.get_lightning_history() | ||
| tx = history.get(self._key) | ||
| if tx is None: | ||
| self._logger.warning(f"Payment key {self._key} not found in history.") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can it happen that the key is missing?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @SomberNight this is what I am thinking,
|
||
| return # Or set fields to empty/default | ||
|
|
||
| self._fee.msatsInt = 0 if not tx.fee_msat else int(tx.fee_msat) | ||
| self._amount.msatsInt = int(tx.amount_msat) | ||
| self._label = tx.label | ||
| self._date = format_time(tx.timestamp) | ||
| self._timestamp = tx.timestamp | ||
| self._status = 'settled' # TODO: other states? get_lightning_history is deciding the filter for us :( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why delete this comment? seems unrelated |
||
| self._status = 'settled' | ||
| self._phash = tx.payment_hash | ||
| self._preimage = tx.preimage | ||
|
|
||
| self.detailsChanged.emit() | ||
|
|
||
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.
why delete this comment?