Code Monkey home page Code Monkey logo

Comments (3)

ey51 avatar ey51 commented on May 27, 2024
  • ingest dag/blocks

    • isChainBlock is always true here

This shouldn't be the case. If it is, then there might be a bug. isChainBlock=true means that the block is part of the selected parent chain, which should not be true for every new block; it should be true only for new blocks that are part of the selected parent chain.

  • ingest dag/selected-parent-chain

    • for each addedChainBlocks set:

      • block[hash].isChainBlock = true

I would first handle removedBlockHashes, and remove them from the selected parent chain; and only then add the addedChainBlocks to the selected parent chain.

* `acceptedBlockHashes` is not used

When handling each block in addedChainBlocks, what you should do is alter each block in addedChainBlock.acceptedBlockHashes such that block.acceptingBlock = addedChainBlock

  • for each removedBlockHashes

    • block[hash].isChainBlock = false

Also here, for each block in removedBlockHashes, you should clear the property acceptingBlockHash of each block that references a block in removedBlockHashes.

Unfortunately, over time this corrupts the state:

Yes, I am guessing the corruption might occurs because you add before removing.

To conclude, your modus operandi of handling the dag/selected-parent-chain updates should be as follows:

Handling removed blocks from the selected parent chain:

for each block R in removedBlockHashes:
  R.isChainBlock=false
  for each block B having B.acceptingBlockHash = R.hash:
    B.acceptingBlockHash=null.

Handling added blocks to the selected parent chain:

for each block A in addedBlockHashes:
  A.isChainBlock=true
  for each block B in A.acceptedBlockHashes: 
    B.acceptingBlockHash=A.hash.

I added all this to the documentation, which you are slowly helping build with your comments =)
https://docs.kas.pa/kaspa/try-kaspa/kasparov-api-server/api/mqtt-topics#block-explorers

Let me know if you have questions.

from dagviz.

aspect avatar aspect commented on May 27, 2024

The issue I had appears to be on my end due to an operation order mistake:

I was processing ADD updates and then REMOVE, however as explained by the team, the REMOVE should be always done first as the same blocks that are removed can be present in the additions.

This has been addressed last release and is online as of Sunday.

from dagviz.

ey51 avatar ey51 commented on May 27, 2024

image
Two sets of chain blocks appear parallel to each other. As seen in the screenshot, a block points to two parents that are both marked as chain blocks. It means these are not two separate data sets. Since each block, can only have one parent that is a chain block (because a block cannot point to two blocks that are related), I think there is a bug of not correctly updating the property isChainBlock.

from dagviz.

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.