Skip to content
Sebastian Grewe edited this page May 31, 2013 · 2 revisions

Description

Each block generated by our miners will first be stored in the blockchain managed by litecoind. We will need to search these blocks and persist them to our database in order to calculate our shares. We reduce overhead of this cron by ensuring that we only list all transactions past our last persisted block.

Workflow

This is the basic workflow of this Cron:

  • Retrieve blockhash of last block persisted to database (if any)
  • Connect to litecoind to gather information
  • listsinceblock to gather latest transactions since last block
  • getdifficulty to store difficulty for the blocks found
  • Parse transactions
  • Transaction of type generate or immature indicates a block
  • Query litecoind for block details via getblock
  • Persist all relevant information to Database
  • Parse added blocks
  • Find blocks upstream accepted share
  • Persist shares and finders to DB

Execution

This cron will run safely without dependencies to other crons. One should ensure that not more than one instance of this cron is running at a time to avoid duplication of blocks.

NOTE: We are safeguarding against that already at database level by adding a UNIQUE index on the block height.

Clone this wiki locally