support to set `nSequence` as a number of second chunks
support to set nSequence as a number of second chunks
Currently this is not supported a laid out in the docs:
Because of the way time locks work, a corresponding time lock needs to be added to the transaction. This can be done in the CashScript SDK through [
addInput()][addInput()] by passing thesequenceas optional argument. However, the value passed into this function will always be treated as a number of blocks, so it is currently not supported to usethis.ageas a number of second chunks.
@kiok46 mentioned the following
I was testing out the nSequence parameter for both block-based and time-based relative locking by setting 22nd bit, so I set it to 0x400001 i.e 4193405 it worked, and in bitcann I have already enforced that at the contract level to always ensure that the nsequence is added as the correct value so it always work. (forced that it must be added in input correctly)
I was this comment in the cashscript next documentation: https://next.cashscript.org/docs/language/globals#thisage
but I tested with the values I mentioned above for 4193405 and for 4193406, it did was is expected increase in relative locking time of 512 seconds for increasing by 1 bit.
so it seems this behavior is supported in a roundabout way, the user needs to pass a correctly encoded hex number (or the corresponding decimal number) to the sequence InputOption but can use 'seconds-chunks' instead of a 'block' value for the sequence number