Package convex.core

Class MergeContext

java.lang.Object
convex.core.MergeContext

public class MergeContext extends Object
Class representing the context to be used for a Belief merge/update function. This context must be created by a Peer to perform a valid Belief merge. It can be safely discarded after use. SECURITY: contains a hot key pair! We need this to sign new belief updates including any chains we want to communicate. Don't allow this to leak anywhere!
  • Method Details

    • create

      public static MergeContext create(AKeyPair kp, long timestamp, State s)
      Create a MergeContext
      Parameters:
      kp - Keypair
      timestamp - Timestamp
      s - Consensus State
      Returns:
      New MergeContext instance
    • getAccountKey

      public AccountKey getAccountKey()
      Get the address of the current Peer (the one performing the merge)
      Returns:
      The Address of the peer.
    • sign

      public <T extends ACell> SignedData<T> sign(T value)
      Sign a value using the keypair for this MergeContext
      Type Parameters:
      T - Type of value
      Parameters:
      value - Value to sign
      Returns:
      Signed value
    • getTimeStamp

      public long getTimeStamp()
      Gets the timestamp of this merge
      Returns:
      Timestamp
    • withTimestamp

      public MergeContext withTimestamp(long newTimestamp)
      Updates the timestamp of this MergeContext
      Parameters:
      newTimestamp - New timestamp
      Returns:
      Updated MergeContext
    • getConsensusState

      public State getConsensusState()
      Gets the Consensus State for this merge
      Returns:
      Consensus State