MASQ-Project / Node

MASQ combines the benefits of VPN and Tor technology to create a superior next-generation privacy software, where users are rewarded for supporting an uncensored global web. Users gain privacy and anonymity online, while helping promote Internet Freedom.
https://masqbrowser.com
Other
173 stars 28 forks source link

Avoid bothering the routing engine if there's no consuming wallet #421

Open dnwiebe opened 6 months ago

dnwiebe commented 6 months ago

The handler for RouteQueryMessage (perhaps RouteQueryRequest by the time this card is played) in Neighborhood invokes the Routing Engine to create a route before checking to see if a consuming wallet has been supplied.

Since the only routes that don't require a consuming wallet are Gossip routes, and RouteQueryMessage is never used for Gossip routes (because they're too simple to require it), every route requested by a RouteQueryMessage always requires a consuming wallet, and requiring the presence of a consuming wallet right when the RouteQueryMessage is received would prevent a call to the Routing Engine in cases where the work of the Routing Engine is about to be discarded anyway.

Move the consuming-wallet check from Neighborhood::compose_route_query_response() to Neighborhood::route_query_message(). If there's no consuming wallet, return None directly (with an appropriate error log) instead of calling deeper.