rusty-kaspa
rusty-kaspa copied to clipboard
Implement disable_relay_tx
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, andDisableRelayTx
in the rest of the codebase.
Maybe two variables, disable_external_txs for mempool oriented? One for saving resources, one for bandwidth?
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