Function createLockHTLC

Creates an HTLC with the given hash of the secret, the expected lock height, the sender public key, and the receiver public key.

Lock createLockHTLC (
  geod24.bitblob.BitBlob!(64L) hash,
  Height lock_height,
  agora.crypto.ECC.Point sender_pk,
  agora.crypto.ECC.Point receiver_pk
) nothrow @safe;

The sending public key may only spend this HTLC if the lock_height in the tx is >= the lock height in the HTLC, and if the signature matches the sender's public key. The sender passes an invalid / fake preimage to switch to the ELSE branch.

The receiving public key may only spend this HTLC if it provides the preimage to the hash. There are no time-locks on this branch. Note however that the actual UTXO being spent is locked in the channel, so it may only be spent once the channel is closed.

Parameters

NameDescription
hash the hash of the secret
lock_height the expected lock_height in the spending transaction
sender_pk the sending public key
receiver_pk the receiving public key

Returns

a lock script which can be unlocked with the right signature & preimage as generated with a call to createUnlockHTLC