Package convex.peer

Class TransactionHandler

java.lang.Object
convex.peer.AThreadedComponent
convex.peer.TransactionHandler

public class TransactionHandler extends AThreadedComponent
Server component for handling client transactions and producing Blocks
  • Field Details

    • txMessageQueue

      protected final ArrayBlockingQueue<Message> txMessageQueue
      Queue for incoming (unverified) transaction messages
    • lastBlockPublishedTime

      protected long lastBlockPublishedTime
  • Constructor Details

    • TransactionHandler

      public TransactionHandler(Server server)
  • Method Details

    • offerTransaction

      public boolean offerTransaction(Message m)
      Offer a transaction for handling
      Parameters:
      m - Message offered
      Returns:
      True if queued for handling, false otherwise
    • processMessage

      protected void processMessage(Message m)
    • maybeReportTransactions

      public void maybeReportTransactions(Peer peer)
    • maybeGenerateBlock

      protected SignedData<Block> maybeGenerateBlock(Peer peer)
      Checks for pending transactions, and if found propose them as a new Block.
      Returns:
      True if a new block is published, false otherwise.
    • close

      public void close()
      Description copied from class: AThreadedComponent
      Close this threaded component, including interrupting any running thread(s). Subclasses may override, but should call `super.close()` to close the main thread
      Overrides:
      close in class AThreadedComponent
    • start

      public void start()
      Description copied from class: AThreadedComponent
      Start the threaded component
      Overrides:
      start in class AThreadedComponent
    • isAwaitingResults

      public boolean isAwaitingResults()
    • countInterests

      public int countInterests()
    • loop

      protected void loop() throws InterruptedException
      Specified by:
      loop in class AThreadedComponent
      Throws:
      InterruptedException
    • getThreadName

      protected String getThreadName()
      Specified by:
      getThreadName in class AThreadedComponent