swaps: only set swap redeemed if preimage is available
For forward swaps this will ensure that the swap only gets set redeemed and cleaned up after the preimage has been extracted, as it could happen that `current_height - spent_height > REDEEM_AFTER_DOUBLE_SPENT_DELAY` is true even if the preimage has not been extracted yet. For reverse swaps this changes nothing as they always have the preimage.
This commit is contained in:
@@ -464,7 +464,7 @@ class SwapManager(Logger):
|
||||
if spent_height in [TX_HEIGHT_LOCAL, TX_HEIGHT_FUTURE]:
|
||||
spent_height = None
|
||||
if spent_height is not None:
|
||||
if spent_height > 0:
|
||||
if spent_height > 0 and swap.preimage:
|
||||
if current_height - spent_height > REDEEM_AFTER_DOUBLE_SPENT_DELAY:
|
||||
self.logger.info(f'stop watching swap {swap.lockup_address}')
|
||||
swap.is_redeemed = True
|
||||
|
||||
Reference in New Issue
Block a user