Struct raiden_network_messages::messages::Unlock
source · pub struct Unlock {
pub message_identifier: MessageIdentifier,
pub payment_identifier: PaymentIdentifier,
pub chain_id: ChainID,
pub token_network_address: TokenNetworkAddress,
pub channel_identifier: U256,
pub transferred_amount: TokenAmount,
pub locked_amount: LockedAmount,
pub locksroot: Locksroot,
pub nonce: U256,
pub secret: Secret,
pub signature: Signature,
}
Expand description
Message used to successfully unlock a lock.
For this message to be valid the balance proof has to be updated to:
- Remove the successful lock from the pending locks and decrement the locked_amount by the lock’s amount, otherwise the sender will pay twice.
- Increase the transferred_amount, otherwise the recipient will reject it because it is not being paid. This message is needed to unlock off-chain transfers for channels that used less frequently then the pending locks’ expiration, otherwise the receiving end would have to go on-chain to register the secret.
This message is needed in addition to the RevealSecret to fix synchronization problems. The recipient can not preemptively update its channel state because there may other messages in-flight. Consider the following case:
- Node A sends a LockedTransfer to B.
- Node B forwards and eventually receives the secret
- Node A sends a second LockedTransfer to B.
At point 3, node A had no knowledge about the first payment having its secret revealed, therefore the pending locks from message at step 3 will include both locks. If B were to preemptively remove the lock it would reject the message.
Fields§
§message_identifier: MessageIdentifier
§payment_identifier: PaymentIdentifier
§chain_id: ChainID
§token_network_address: TokenNetworkAddress
§channel_identifier: U256
§transferred_amount: TokenAmount
§locked_amount: LockedAmount
§locksroot: Locksroot
§nonce: U256
§secret: Secret
§signature: Signature
Trait Implementations§
source§impl<'de> Deserialize<'de> for Unlock
impl<'de> Deserialize<'de> for Unlock
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<SendUnlock> for Unlock
impl From<SendUnlock> for Unlock
source§fn from(event: SendUnlock) -> Self
fn from(event: SendUnlock) -> Self
Converts to this type from the input type.
source§impl PartialEq for Unlock
impl PartialEq for Unlock
source§impl SignedEnvelopeMessage for Unlock
impl SignedEnvelopeMessage for Unlock
fn message_hash(&self) -> H256
source§impl SignedMessage for Unlock
impl SignedMessage for Unlock
fn bytes_to_sign(&self) -> Vec<u8>
fn sign(&mut self, key: PrivateKey) -> Result<(), SigningError>
fn sign_message(&self, key: PrivateKey) -> Result<Signature, SigningError>
impl Eq for Unlock
impl StructuralPartialEq for Unlock
Auto Trait Implementations§
impl Freeze for Unlock
impl RefUnwindSafe for Unlock
impl Send for Unlock
impl Sync for Unlock
impl Unpin for Unlock
impl UnwindSafe for Unlock
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.