python-nostr
python-nostr copied to clipboard
Mutable argument
https://github.com/jeffthibault/python-nostr/blob/69ff17b163f8af40f9514bcf7937964cb22997a2/nostr/relay_manager.py#L22
Problem: "subscriptions" argument is a dict, which is mutable in python. This leads to the problem of handling all relay's subscriptions as the same object.
If I add a subscription only to 1 relay, it will be added to all relays. This is seemingly not an issue, but it is the same for deleting a subscription from 1 relay, deletes from all other. So the for cycle in RelayManager will fail to close the second relay's subscription, because it is closed when we close the first relay's subscription.
Also in relay class