chainsyncer

Blockchain syncer driver
Info | Log | Files | Refs | LICENSE

filter.texi (1647B)


      1 @node chainsyncer-filter
      2 @section Syncer filter
      3 
      4 A filter is a piece of code that gets executed for every transaction in a block.
      5 
      6 The filter will receive the block and transaction data, aswell as an RPC and syncer backend connection. This enables the code interact with the blockchain node provisioning the chain context of the syncer session, aswell as all chain-specific details of the specific block and transaction at the current syncer state.
      7 
      8 
      9 @subsection Filter execution state
     10 
     11 The syncer keeps track of which filters have been executed for which transaction.
     12 
     13 Every filter added to the syncer adds a new bit to a bit field constituting a filter flag. When a filter has finished executing, the bit corresponding to the filter's index in the syncer filter array should be set and stored.
     14 
     15 Since atomicity across code execution and flag setting cannot be guaranteed, it is the implementer's responsibility to ensure that a @emph{started} filter execution actually has been @emph{completed}. If proper care is not taken, individual filter code @emph{may} be run twice for a particular transaction.
     16 
     17 Allowing for disambiguation between started and completed filters should be in scope for imminent improvement of the syncer package.
     18 
     19 
     20 @subsection Integrity protection
     21 
     22 Backends may optionally enable filter integrity protection. In practice this means that if a specific syncer session was started with a specific collection of filters, the syncer session may not be resumed with a different collection of filters.
     23 
     24 Depending on the implementation, the collection of filters may or may not be dependent on the order in which they are added.
     25