rusty-kaspa icon indicating copy to clipboard operation
rusty-kaspa copied to clipboard

Implement disable_relay_tx

Open coderofstuff opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. Yes - a user that only wants to use the node as an API does not need to receive tx messages. Not having to deal with txs will reduce mempool use.

Describe the solution you'd like Implement the disable_relay_tx flag. When enabled, this lets a node's peers that it doesn't want to receive transactions. The peers will not send txs to this node.

Describe alternatives you've considered N/A

Additional context

One consideration is the issue of starvation: What if a node that wants to receive txs is only connected to peers that have DisableRelayTx=false?

Notes

  • Rust code: in flow_context.rs the line // TODO: disable_relay_tx from config/cmd is where this would go
  • Go code: this was BlockOnly in config, and DisableRelayTx in the rest of the codebase.

coderofstuff avatar Jul 20 '23 16:07 coderofstuff

Maybe two variables, disable_external_txs for mempool oriented? One for saving resources, one for bandwidth?

KaffinPX avatar Jul 24 '23 18:07 KaffinPX

The idea I had for the possible starvation issue:

  • assuming you're at max peer connections, evict/disconnect any of the ones you're connected to
  • stop yourself from connecting to that peer you just removed
  • this opens up a slot for a new peer to come in that might be able to give you txs

coderofstuff avatar Jul 24 '23 19:07 coderofstuff