coinkite / connectrum

Python3 library to simplify client access to Electrum servers
https://pypi.python.org/pypi/connectrum
MIT License
49 stars 21 forks source link

svr.protocols should return protocols only #1

Closed notpushkin closed 7 years ago

notpushkin commented 7 years ago

This would make KnownServers.select work correctly with custom ports.

Now:

>>> ServerInfo("electrum-ltc.petrkr.net", "electrum-ltc.petrkr.net",
...            "t60001 s60002").protocols
{'s60002', 't60001'}

>>> ks = KnownServers()
>>> ks.add_single("electrum-ltc.petrkr.net", "t60001 s60002")
>>> ks.select(protocol="s")
[]  # no server ._.

Should be:

>>> ServerInfo("electrum-ltc.petrkr.net", "electrum-ltc.petrkr.net",
...            "t60001 s60002").protocols
{'s', 't'}

>>> ks = KnownServers()
>>> ks.add_single("electrum-ltc.petrkr.net", "t60001 s60002")
>>> ks.select(protocol="s")
[<ServerInfo electrum-ltc.petrkr.net ...>]  # yay!
notpushkin commented 7 years ago

(I'll send a pull request tomorrow!)

notpushkin commented 7 years ago

(Unrelated; I've also made the CLI example into a full-fledged REPL here: https://github.com/iamale/estrato)

doc-hex commented 7 years ago

Please do make a PR for this change and nice REPL!