Coder Social home page Coder Social logo

Comments (6)

AlexITC avatar AlexITC commented on July 20, 2024

Here is a simple implementation that detects what operations need to be applied in order to syncrhonize a block database with the one from the bitcoin node: LedgerSynchronizationStatusService#getSyncingStatus.

While the code is in Scala, the comments should give you the idea of how it works:

  /**
   * Lets define some values:
   * - The candidate is the block that needs to be stored.
   * - The latestLedgerBlock is the newer block that is stored.
   * - The LCA is the least common ancestor between both chains.
   *
   * There are some trivial cases to handle:
   * - There are no blocks stored, just sync everything.
   * - The candidate is already stored, just ignore it.
   *
   * So, let's assume that:
   * - The candidate is not stored.
   * - We have at least a block stored (latestLedgerBlock).
   * - The LCA is on the candidate's chain, and on our stored blocks.
   *
   * Then, we can apply the candidate by rolling back until the LCA, then, applying missing blocks until catching up
   * the candidate.
   *
   * @param candidate the block that we need to store
   * @return the state that needs to be applied in order to store the candidate block
   */

from sidetree.

thehenrytsai avatar thehenrytsai commented on July 20, 2024

Resolution logic is independent of late-publishing of operations. And are tests written for roll-back detection and handling. Will rename this to be more of an documentation issue instead.

from sidetree.

OR13 avatar OR13 commented on July 20, 2024

Non normative section with text.

from sidetree.

OR13 avatar OR13 commented on July 20, 2024

What happens when I publish on ledger, but not on CAS... then later on CAS, and history changes... is it a feature, or is it a defect...

from sidetree.

OR13 avatar OR13 commented on July 20, 2024

@csuwildcat need to add language about how to address this, and handle the new version history.

from sidetree.

csuwildcat avatar csuwildcat commented on July 20, 2024

Done

from sidetree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.