hypercore-one / syrius

MIT License
0 stars 0 forks source link

Enable wakelock and disable auto-lock when swap is active #19

Closed vilkris4 closed 1 year ago

vilkris4 commented 1 year ago

The purpose of this PR is to ensure that the host machine does not go into sleep mode and that Syrius' keystore stays unlocked when Syrius is left running for extended periods of time while participating in an incoming P2P swap. It is important that Syrius can actively monitor the chain for the preimage in this situation.

The wakelock is enabled when there are active incoming P2P swaps. The wakelock attempts to keep the host machine from going into sleep mode. The wakelock is not supported on Linux.

It is also important that the keystore stays unlocked while an incoming swap is being conducted, since Syrius has to automatically send the transaction to complete the swap safely. The user is informed via a tooltip that Syrius will not auto-lock when the swap is in progress.

georgezgeorgez commented 1 year ago

Stuff like that really makes me think that the htlc indexing needs to be done node side through configurable opt-in indexing We could merge this in right now But maybe in the future, we should re-evaluate Keeping an unlocked wallet open like this means users may walk away from their computers etc Not great Is there a UI lock option, that keeps the htlc unlocking and autoreceiving but requiring a password to do things like send other txs

vilkris4 commented 1 year ago

Yes this feature is somewhat controversial. Some kind of UI level lock could be introduced that would honor the user's auto-lock timeout setting but would still allow the keystore to remain unlocked for the duration of the swap.

I'm not sure if indexing on the node necessarily helps with this problem because the keystore has to stay unlocked so that the unlock transaction can be sent automatically.

Since auto-locking is only disabled when you have joined a swap, that means that the auto-lock is disabled for a maximum of 1 hour + the auto-lock timeout setting value. 1 hour being the maximum expiration time when joining a swap. Unless of course you're doing multiple swaps sequentially.

If watchtowers can be trusted then this feature loses some value.

georgezgeorgez commented 1 year ago

With node level indexing, the model could change from needing Syrius running while the preimage is posted to needing to open syrius before the timeout expires.

georgezgeorgez commented 1 year ago

I'll approve it since the code seems to do what you're saying it will do. I'll leave it up to your judgement what the better UI is. Or rather UX

vilkris4 commented 1 year ago

Alright, I'll leave this open for a bit to give others a chance to comment.