Skip to main content

ChannelActorData

Struct ChannelActorData 

Source
pub struct ChannelActorData {
Show 44 fields pub state: ChannelState, pub public_channel_info: Option<PublicChannelInfo>, pub local_tlc_info: ChannelTlcInfo, pub remote_tlc_info: Option<ChannelTlcInfo>, pub local_pubkey: Pubkey, pub remote_pubkey: Pubkey, pub id: Hash256, pub funding_tx: Option<Transaction>, pub funding_tx_confirmed_at: Option<(H256, u32, u64)>, pub funding_udt_type_script: Option<Script>, pub is_acceptor: bool, pub is_one_way: bool, pub to_local_amount: u128, pub to_remote_amount: u128, pub local_reserved_ckb_amount: u64, pub remote_reserved_ckb_amount: u64, pub commitment_fee_rate: u64, pub commitment_delay_epoch: u64, pub funding_fee_rate: u64, pub signer: InMemorySigner, pub local_channel_public_keys: ChannelBasePublicKeys, pub commitment_numbers: CommitmentNumbers, pub local_constraints: ChannelConstraints, pub remote_constraints: ChannelConstraints, pub tlc_state: TlcState, pub retryable_tlc_operations: VecDeque<RetryableTlcOperation>, pub waiting_forward_tlc_tasks: HashMap<TLCId, [u8; 32]>, pub remote_shutdown_script: Option<Script>, pub local_shutdown_script: Script, pub last_committed_remote_nonce: Option<PubNonce>, pub remote_revocation_nonce_for_verify: Option<PubNonce>, pub remote_revocation_nonce_for_send: Option<PubNonce>, pub remote_revocation_nonce_for_next: Option<PubNonce>, pub latest_commitment_transaction: Option<Transaction>, pub remote_commitment_points: Vec<(u64, Pubkey)>, pub remote_channel_public_keys: Option<ChannelBasePublicKeys>, pub local_shutdown_info: Option<ShutdownInfo>, pub remote_shutdown_info: Option<ShutdownInfo>, pub shutdown_transaction_hash: Option<H256>, pub reestablishing: bool, pub last_revoke_ack_msg: Option<RevokeAndAck>, pub created_at: SystemTime, pub pending_replay_updates: Vec<TlcReplayUpdate>, pub last_was_revoke: bool,
}
Expand description

The core serializable state of a channel actor.

This struct contains all the persistable fields of a channel. Runtime-only fields (like actor references) are managed separately in fiber-lib.

Fields§

§state: ChannelState§public_channel_info: Option<PublicChannelInfo>

The data below are only relevant if the channel is public.

§local_tlc_info: ChannelTlcInfo§remote_tlc_info: Option<ChannelTlcInfo>§local_pubkey: Pubkey

The local public key used to establish p2p network connection.

§remote_pubkey: Pubkey

The remote public key used to establish p2p network connection.

§id: Hash256§funding_tx: Option<Transaction>§funding_tx_confirmed_at: Option<(H256, u32, u64)>§funding_udt_type_script: Option<Script>§is_acceptor: bool

Is this channel initially inbound? An inbound channel is one where the counterparty is the funder of the channel.

§is_one_way: bool

Is this channel one-way? Combines with is_acceptor to determine if the channel able to send payment to the counterparty or not.

§to_local_amount: u128

The amount of CKB/UDT that we own in the channel. This value will only change after we have resolved a tlc.

§to_remote_amount: u128

The amount of CKB/UDT that the remote owns in the channel. This value will only change after we have resolved a tlc.

§local_reserved_ckb_amount: u64

These two amounts used to keep the minimal ckb amount for the two parties. TLC operations will not affect these two amounts, only used to keep the commitment transactions to be valid, so that any party can close the channel at any time.

§remote_reserved_ckb_amount: u64§commitment_fee_rate: u64

The commitment fee rate is used to calculate the fee for the commitment transactions. The side who want to submit the commitment transaction will pay fee.

§commitment_delay_epoch: u64

The delay time for the commitment transaction, this value is set by the initiator of the channel. It must be a relative EpochNumberWithFraction in u64 format.

§funding_fee_rate: u64

The fee rate used for funding transaction, the initiator may set it as funding_fee_rate option, if it’s not set, DEFAULT_FEE_RATE will be used as default value, two sides will use the same fee rate.

§signer: InMemorySigner

Signer is used to sign the commitment transactions.

§local_channel_public_keys: ChannelBasePublicKeys

Cached channel public keys for easier of access.

§commitment_numbers: CommitmentNumbers

Commitment numbers that are used to derive keys. This value is guaranteed to be 0 when channel is just created.

§local_constraints: ChannelConstraints§remote_constraints: ChannelConstraints§tlc_state: TlcState

All the TLC related information.

§retryable_tlc_operations: VecDeque<RetryableTlcOperation>

The retryable tlc operations that are waiting to be processed.

§waiting_forward_tlc_tasks: HashMap<TLCId, [u8; 32]>§remote_shutdown_script: Option<Script>

The remote lock script for close channel, setup during the channel establishment.

§local_shutdown_script: Script

The local lock script for close channel.

§last_committed_remote_nonce: Option<PubNonce>

Basically the latest remote nonce sent by the peer with the CommitmentSigned message, but we will only update this field after we have sent a RevokeAndAck to the peer.

§remote_revocation_nonce_for_verify: Option<PubNonce>§remote_revocation_nonce_for_send: Option<PubNonce>§remote_revocation_nonce_for_next: Option<PubNonce>§latest_commitment_transaction: Option<Transaction>

The latest commitment transaction we’re holding, it can be broadcasted to blockchain by us to force close the channel.

§remote_commitment_points: Vec<(u64, Pubkey)>

All the commitment point that are sent from the counterparty. We need to save all these points to derive the keys for the commitment transactions.

§remote_channel_public_keys: Option<ChannelBasePublicKeys>§local_shutdown_info: Option<ShutdownInfo>

The shutdown info for both local and remote, setup by the shutdown command or message.

§remote_shutdown_info: Option<ShutdownInfo>§shutdown_transaction_hash: Option<H256>

Transaction hash of the shutdown transaction. The shutdown transaction can be COOPERATIVE or UNCOOPERATIVE.

§reestablishing: bool

A flag to indicate whether the channel is reestablishing, we won’t process any messages until the channel is reestablished.

§last_revoke_ack_msg: Option<RevokeAndAck>§created_at: SystemTime§pending_replay_updates: Vec<TlcReplayUpdate>

TLC updates sent to peer since the last local CommitmentSigned. This preserves send order for reestablish replay.

§last_was_revoke: bool

Tracks whether the last outbound sync message was RevokeAndAck.

Trait Implementations§

Source§

impl Clone for ChannelActorData

Source§

fn clone(&self) -> ChannelActorData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de> Deserialize<'de> for ChannelActorData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ChannelActorData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,