The lock script args is the hash result of blake160(local_delay_epoch || local_delay_pubkey_hash || revocation_pubkey_hash || N * pending_htlc), to unlock this lock, the transaction must provide following fields in the witness:
- `local_delay_epoch`: 8 bytes, u64 in little endian, must be a relative EpochNumberWithFraction
- `local_delay_pubkey_hash`: 20 bytes, hash result of blake160(local_delay_pubkey)
- `revocation_pubkey_hash`: 20 bytes, hash result of blake160(revocation_pubkey)
- `pending_htlc`: A group of pending HTLCS, each HTLC is 85 bytes, contains:
- `htlc_type`: 1 byte, 0x00 for offered HTLC, 0x01 for received HTLC
- `payment_amount`: 16 bytes, u128 in little endian
- `payment_hash`: 20 bytes
- `remote_htlc_pubkey_hash`: 20 bytes, hash result of blake160(remote_htlc_pubkey)
- `local_htlc_pubkey_hash`: 20 bytes, hash result of blake160(local_htlc_pubkey)
- `htlc_expiry`: 8 bytes, u64 in little endian, must be an absolute timestamp
- `unlock_type`: 1 byte, 0x00 ~ 0xFE for pending HTLC unlock, 0xFF for non-pending HTLC unlock
- `signature`: 65 bytes, the signature of the xxx_pubkey
- `preimage`: 32 bytes, an optional field to provide the preimage of the payment_hash
Currently upstream ckb-pcn-scripts uses absolute timestamp for htlc expiry. https://github.com/quake/ckb-pcn-scripts/blob/f61fcb3161c751b7395f8eb3627f1fcff93c32ba/contracts/commitment-lock/README.md#L5
We should follow that.