Browse Source

lnwatcher.inspect_tx_candidate: handle witness being None

```
E/W | lnwatcher.LNWalletWatcher.[test_segwit_2-LNW] | Exception in trigger_callbacks: AssertionError('witness is missing! txid=49f0fe532c07ec099ea3a9540a06141f529d28244c3a7be20f54843636cd7380. rawtx=cHNidP8BAFICAAAAAbliIHcoL1ZXwvRfBrjmhEJ63isM+wBBiCoZW231T2jhAAAAAAD9////AbMsQQAAAAAAFgAURC0BRfNFWqqD+jbsTaiX0/qjrE2v2iIAAAEA/S8BAgAAAAABAVbd14mCS0q4HjYGhWppSXvBvx9POsTYDSwXAIkxJF1iAAAAAAD/////ASEtQQAAAAAAFgAUh+Ku4dqhbNrjKjcK65dsZAWV+ocEAEcwRAIgcILGbxQK7wxiq1yBY6GxGBs4A32pBzC4PUSiMY0QuVMCIGtWnoRD/2zx4BshRYeHsg7wp9ClplQWxjsBJszXEcPfAUgwRQIhAPn0dsBeyqW4U0TbOgJMMEEuKwqBXfXHryHJvOxcwKafAiBRBBFpJvYxMtjkg7aABj1yUEwBaZuAqg1a8mlbHLKnBwFHUiECRc2elI2LEqEE31/G9tC6IA4yV09nKK6nSTez2vUlVikhAxbmJytLCOgHfz1vFqKrZMhERzVCJd0AaAkBWZqMKbe6Uq4AAAAAIgYDtG0jdrMO8FbxdAepULYg1Hu8fbq6hQ7Ki35K6/TViEQQ0uN52gAAAIABAAAAgQAAAAAiAgIP7MeuyqhS6fOpbLYY/1R+Rgmc0sYyA5GHEXBYOpWSoBDS43naAAAAgAAAAAB7AAAAAA==')
Traceback (most recent call last):
  File "...\electrum\electrum\util.py", line 1176, in wrapper
    return await func(*args, **kwargs)
  File "...\electrum\electrum\lnwatcher.py", line 213, in trigger_callbacks
    await callback()
  File "...\electrum\electrum\lnwatcher.py", line 219, in check_onchain_situation
    spenders = self.inspect_tx_candidate(funding_outpoint, 0)
  File "...\electrum\electrum\lnwatcher.py", line 297, in inspect_tx_candidate
    r = self.inspect_tx_candidate(spender_txid+':%d'%i, n+1)
  File "...\electrum\electrum\lnwatcher.py", line 281, in inspect_tx_candidate
    assert witness, f"witness is missing! txid={spender_txid}. rawtx={str(spender_tx)}"
AssertionError: witness is missing! txid=49f0fe532c07ec099ea3a9540a06141f529d28244c3a7be20f54843636cd7380. rawtx=cHNidP8BAFICAAAAAbliIHcoL1ZXwvRfBrjmhEJ63isM+wBBiCoZW231T2jhAAAAAAD9////AbMsQQAAAAAAFgAURC0BRfNFWqqD+jbsTaiX0/qjrE2v2iIAAAEA/S8BAgAAAAABAVbd14mCS0q4HjYGhWppSXvBvx9POsTYDSwXAIkxJF1iAAAAAAD/////ASEtQQAAAAAAFgAUh+Ku4dqhbNrjKjcK65dsZAWV+ocEAEcwRAIgcILGbxQK7wxiq1yBY6GxGBs4A32pBzC4PUSiMY0QuVMCIGtWnoRD/2zx4BshRYeHsg7wp9ClplQWxjsBJszXEcPfAUgwRQIhAPn0dsBeyqW4U0TbOgJMMEEuKwqBXfXHryHJvOxcwKafAiBRBBFpJvYxMtjkg7aABj1yUEwBaZuAqg1a8mlbHLKnBwFHUiECRc2elI2LEqEE31/G9tC6IA4yV09nKK6nSTez2vUlVikhAxbmJytLCOgHfz1vFqKrZMhERzVCJd0AaAkBWZqMKbe6Uq4AAAAAIgYDtG0jdrMO8FbxdAepULYg1Hu8fbq6hQ7Ki35K6/TViEQQ0uN52gAAAIABAAAAgQAAAAAiAgIP7MeuyqhS6fOpbLYY/1R+Rgmc0sYyA5GHEXBYOpWSoBDS43naAAAAgAAAAAB7AAAAAA==
```
patch-4
SomberNight 3 years ago
parent
commit
b6b7b0a6c0
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 5
      electrum/lnwatcher.py

5
electrum/lnwatcher.py

@ -273,6 +273,11 @@ class LNWatcher(Logger, EventListener):
return result
o = spender_tx.inputs()[0]
witness = o.witness_elements()
if not witness:
# This can happen if spender_tx is a local unsigned tx in the wallet history, e.g.:
# channel is coop-closed, outpoint is for our coop-close output, and spender_tx is an
# arbitrary wallet-spend.
return result
redeem_script = witness[-1]
if match_script_against_template(redeem_script, WITNESS_TEMPLATE_OFFERED_HTLC):
#self.logger.info(f"input script matches offered htlc {redeem_script.hex()}")

Loading…
Cancel
Save