stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 666 forks source link

[Nakamoto] Nakamoto p2p block support #4069

Closed jcnelson closed 3 months ago

jcnelson commented 10 months ago

We need to support Nakamoto block handling in the p2p system in order to unblock a lot of other tasks. This includes:

jbencin commented 10 months ago

I looked over the code a bit this morning and I think I understand what to do, just want to confirm some things before I get too far:

cc @jcnelson @kantai

jcnelson commented 10 months ago

For the wire format, we'll need something like the BlocksData struct, but for Nakamoto blocks. I probably shouldn't modify the existing BlocksData though because that would change the wire format, right?

Correct; BlocksData would be a good source of inspiration. Also, we need to keep all existing p2p messages and code paths for now since Nakamoto nodes still need to process epoch 2.x data (including p2p traffic).

In general, is it preferable to make existing code accept either StacksBlock or Nakamoto, or leave existing code alone as much as possible, instead copying and modifying it for NakamotoBlock? I'm guessing the later...

That depends on how functionally similar the Nakamoto versus epoch 2.x code paths are. I'd prefer to see a first draft that has different code paths, and then we can think about consolidation afterwards, so then at least we can all be on the same page as to how similar/different Nakamoto block p2p processing is going to be.

jcnelson commented 4 months ago

@saralab This is still a work in progress