jimmysong / programmingbitcoin

Repository for the book
Other
1.73k stars 653 forks source link

ConnectionResetError #199

Open teafff opened 3 years ago

teafff commented 3 years ago

i am testing ch-10 test, but the server might be closed

How could i do now? Can you give me some advises?

code: node = SimpleNode('testnet.programmingbitcoin.com', testnet=True) version = VersionMessage() node.send(version) verack_received = False version_received = False while not verack_received and not version_received: message = node.wait_for(VersionMessage,VerAckMessage) if message.command == VerAckMessage.command: verack_received = True else: verack_received = True node.send(VerAckMessage())

result: Traceback (most recent call last): File "D:/PyWork/BitCoin/NodeTest.py", line 12, in message = node.wait_for(VersionMessage,VerAckMessage) File "D:\PyWork\BitCoin\Moudle\network.py", line 203, in wait_for envelope = self.read() File "D:\PyWork\BitCoin\Moudle\network.py", line 194, in read envelope = NetworkEnvelope.parse(self.stream, testnet=self.testnet) File "D:\PyWork\BitCoin\Moudle\network.py", line 29, in parse magic = s.read(4) File "D:\Anaconda3\lib\socket.py", line 575, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054]

hunsuk commented 2 years ago

i have had your same problem you shoud to chenge code https://github.com/jimmysong/programmingbitcoin/compare/master...hunsuk:patch-1?diff=unified

( i reference https://github.com/zeltsi/byob/blob/master/p2p/version.py)