Function FlashAPI.closeChannel

Requests collaboratively closing an existing channel with this peer.

abstract Result!(agora.crypto.ECC.Point) closeChannel (
  PublicKey sender_pk,
  PublicKey recv_pk,
  geod24.bitblob.BitBlob!(64L) chan_id,
  uint seq_id,
  agora.crypto.ECC.Point peer_nonce,
  Amount fee
) @safe;

If the called node accepts the close request and plans to return the signature, it should mark the channel as PendingClose and should reject all subsequent attempts at updating the channel state.

If the peer unreasonably rejects or ignores closure requests for up to cooperative_close_timeout as set up in the config, the counter-party might trigger a unilateral close of the channel.

Note that cooperative_close_timeout is not enforceable, it's only used as an intended timeout used by both peers. The settle_time of the settlement branch in the trigger / update transactions is the only enforcable parameter by the blockchain, therefore the node should always monitor the blockchain for any premature publishing of the trigger transaction.

Parameters

NameDescription
sender_pk the sender public key as managed by the counter-party. (note: will be used for signature authentication later)
recv_pk the receiving public key. If the receiving flash node does not manage this key it will return an error.
chan_id the channel ID to close
seq_id the sequence ID
peer_nonce the nonce the calling peer will use
fee the proposed fee

Returns

the signature for the closing transaction, or an error code with an optional error message.