Struct ChainHash
- Namespace
- NLightning.Common.Types
- Assembly
- NLightning.Common.dll
Represents a chain hash.
public readonly struct ChainHash
- Inherited Members
Remarks
A chain hash is a 32 byte hash that is used to identify a chain.
Constructors
ChainHash(byte[])
Initializes a new instance of the ChainHash struct.
public ChainHash(byte[] value)
Parameters
value
byte[]The value of the chain hash.
Exceptions
- ArgumentOutOfRangeException
Thrown when the value is not 32 bytes.
Fields
LENGTH
The length of a chain hash.
public const int LENGTH = 32
Field Value
Methods
DeserializeAsync(Stream)
public static Task<ChainHash> DeserializeAsync(Stream stream)
Parameters
stream
Stream
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
SerializeAsync(Stream)
public ValueTask SerializeAsync(Stream stream)
Parameters
stream
Stream
Returns
Operators
operator ==(ChainHash, ChainHash)
public static bool operator ==(ChainHash left, ChainHash right)
Parameters
Returns
implicit operator byte[](ChainHash)
public static implicit operator byte[](ChainHash c)
Parameters
Returns
- byte[]
implicit operator ReadOnlyMemory<byte>(ChainHash)
public static implicit operator ReadOnlyMemory<byte>(ChainHash c)
Parameters
Returns
implicit operator ChainHash(byte[])
public static implicit operator ChainHash(byte[] value)
Parameters
value
byte[]
Returns
operator !=(ChainHash, ChainHash)
public static bool operator !=(ChainHash left, ChainHash right)