Bitcoin Forum
June 16, 2024, 10:19:26 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Lifecycle of a Message  (Read 1022 times)
cloudboy (OP)
Hero Member
*****
Offline Offline

Activity: 690
Merit: 501


View Profile
August 20, 2014, 04:31:41 AM
Last edit: August 20, 2014, 05:10:08 AM by cloudboy
 #1

I understand that messages are handled by ThreadMessageHandler in net.cpp, and are received/sent/processed in main.cpp.

My questions are:
  • If an unknown message is received (it will hit the final else statement in ProcessMessage() and be ignored) will it still be propagated to other nodes?
  • Is pnode->PushMessage() enough to broadcast a message? From what I understand, it adds the message to the queue of outgoing messages, which are then gathered by    SendMessages() and sent.
  • Is it possible to assign an expiration date to an individual message? So all nodes know to stop propagating it at that time?
  • How can you reject an incoming message and make sure it doesn't get relayed or processed?

Thanks
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5236
Merit: 13088


View Profile
August 20, 2014, 06:50:37 PM
 #2

Quote
If an unknown message is received (it will hit the final else statement in ProcessMessage() and be ignored) will it still be propagated to other nodes?

No.

Quote
Is pnode->PushMessage() enough to broadcast a message? From what I understand, it adds the message to the queue of outgoing messages, which are then gathered by    SendMessages() and sent.

PushMessage sends a message to a peer. Only certain message types are then broadcast to the rest of the network.

Quote
Is it possible to assign an expiration date to an individual message? So all nodes know to stop propagating it at that time?

No, but that's not necessary. Nodes don't propagate duplicate information, so block/tx/addr broadcasts reach every network node in a matter of minutes and then stop propagating.

Quote
How can you reject an incoming message and make sure it doesn't get relayed or processed?

Just ignore it when you receive it. ProcessMessage would probably be a good place to put additional logic of this sort.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!