Closed channels don't get deleted out of memory
Closing a channel currently only closes down the payment channel. The rest of the network does not get informed about that channel not being active anymore. We need to broadcast some kind of cancel-object (or maybe a status object with zero capacity on both sides) to let the network know that they should not count on it for routing anymore.
For now closing a channel and reopening a channel with another node may lead to refunded payments.
Or maybe we each node could have a channel heart beat that makes the other node close connection with if it stops
Oh we do that already, there is a standard ping behaviour between nodes.
The bigger problem is that when a channel is closed, other nodes will not get notified and will keep trying to route through that channel.
Ok then here is an idea. it is a new routing system when you want a payment routed across the network you ask for a signature from the payment receiver which is relayed to all nodes you are connected to and each node will do this step and also ask there clients for the signature once there is a valid signature then payments will be routed in a channel between the to users the rule of thumb will always be root back over from the node you received the message first from this has the added advantage of always finding the fastest route.
1: once a node has received a request for a signature it wont re-relay that signature request this is stop the network relaying the requests in a loop
2: also when a reply to the signature request is given to a node from the payment receiver it will send it to the node that gave the request to it and so on until it reaches the paying user
3: this happens before paying and after connecting to a hub
4: finally if a request is answered before the request has reached everyone you stop listening for reply to you request (if your friend who will be payed is connected to meany nodes he will also wont answer any identical requests) now you will wait until the network wont relay the request any more.
ps: request does not contain payment info all it is. is a random nonce to be signed by an address structure of request will be [payer_addr, nonce].