Question about current timestamp for LSPS5 #3676
Replies: 1 comment
-
Excuse the delay answering on the PR. So, as mentioned there, From the options above I think I'd prefer Option 1. FWIW, another option would be to create a |
Beta Was this translation helpful? Give feedback.
-
Hey all, I have a question about handling time for some LSPS5 features. The spec needs the current time for things like:
last used
propertyI tried using a clock feature from
chrono
on this PR, but @tnull commented that it depends on std so I should not use it.I saw some messages from discord explaining that we usually use the block time (±2 hours) to get the time in a no-std/wasm context. My worry is that using block time might not be accurate enough or could lead to unexpected behavior.
I have browsed Discord and GitHub issues but couldn’t find a definitive solution. I'm considering two options:
For each public method defined on the spec that uses time, have both std and no-std versions (e.g.,
handle_set_webhook()
andhandle_set_webhook_no_std()
). In the no-std version, add an extra parametercurrent_time: Duration
.Have a method like this:
Note that this option would require changing ChannelManager to expose highest_seen_timestamp.
Also, take into account that for verifying signatures, the spec says that the LSPS5 client expects a time difference of up to 10 minutes, so in the no-std context this can be problematic, since the timestamp would have a +- 2 hour error.
Is there a recommended way to get a more reliable current time in this no-std context, or should I just use the block time approximation and maybe review the spec to take this into consideration?
Thanks for any advice!
Beta Was this translation helpful? Give feedback.
All reactions