satwikkansal / python_blockchain_app

A fully functional blockchain application implemented in Python from scratch (with tutorial).
819 stars 471 forks source link

Node Register - Own node_adress never returned #31

Open gerardkm94 opened 4 years ago

gerardkm94 commented 4 years ago

When a new register is done (one node to another), the "parent" node, or the node who receives the request never returns its own node_adress. For that reason, on children Node will be always necessary to register first a node, and then syncing.

I'll open a new branch, but not sure if I'm missing something.

Ty!

satwikkansal commented 4 years ago

Ah yes, the parent node should be updated too in the register_with API here. Thanks for pointing this out.

I'll open a new branch, but not sure if I'm missing something.

That'd be great, thanks again.

fabiankirstein commented 4 years ago

Hello! I also came across this bug. I was about to fix it, but I'm also not sure about the general concept here. Is every node suppose to store every address of all other nodes? And what is about the own address of one node? I guess it should not be part of the peers set.

satwikkansal commented 3 years ago

Hi! Sorry for the late response.

Is every node suppose to store every address of all other nodes?

If the network is large (1000s of nodes), that'd be an inefficent way. Usually, there's some variation of gossip protocol for broadcasting that's implemented, I'm not certain about the specifics though.

And what is about the own address of one node? I guess it should not be part of the peers set.

Yes, that's true, it should not be a part of peers set, but for the set up in this project we should add it to the response when some new node registers via it.