Package org.ldk.structs
Class CounterpartyCommitmentSecrets
- java.lang.Object
-
- org.ldk.structs.CounterpartyCommitmentSecrets
-
public class CounterpartyCommitmentSecrets extends Object
Implements the per-commitment secret storage scheme from [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes or so.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CounterpartyCommitmentSecrets
clone()
Creates a copy of the CounterpartyCommitmentSecretsprotected void
finalize()
long
get_min_seen_secret()
Returns the minimum index of all stored secrets.byte[]
get_secret(long idx)
Returns the secret at `idx`.static CounterpartyCommitmentSecrets
of()
Creates a new empty `CounterpartyCommitmentSecrets` structure.Result_NoneNoneZ
provide_secret(long idx, byte[] secret)
Inserts the `secret` at `idx`.static Result_CounterpartyCommitmentSecretsDecodeErrorZ
read(byte[] ser)
Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_writebyte[]
write()
Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
clone
public CounterpartyCommitmentSecrets clone()
Creates a copy of the CounterpartyCommitmentSecrets
-
of
public static CounterpartyCommitmentSecrets of()
Creates a new empty `CounterpartyCommitmentSecrets` structure.
-
get_min_seen_secret
public long get_min_seen_secret()
Returns the minimum index of all stored secrets. Note that indexes start at 1 << 48 and get decremented by one for each new secret.
-
provide_secret
public Result_NoneNoneZ provide_secret(long idx, byte[] secret)
Inserts the `secret` at `idx`. Returns `Ok(())` if the secret was generated in accordance with BOLT 3 and is consistent with previous secrets.
-
get_secret
@Nullable public byte[] get_secret(long idx)
Returns the secret at `idx`. Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-
write
public byte[] write()
Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
-
read
public static Result_CounterpartyCommitmentSecretsDecodeErrorZ read(byte[] ser)
Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
-
-