Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol.py fails against btcd #6

Closed
dajohi opened this issue Feb 28, 2014 · 2 comments
Closed

protocol.py fails against btcd #6

dajohi opened this issue Feb 28, 2014 · 2 comments
Assignees
Labels

Comments

@dajohi
Copy link

dajohi commented Feb 28, 2014

btcd (https://github.com/conformal/btcd) is a full node bitcoin implementation written in Go. btcd does two separate writes, one for the header and the other for the payload:

        // Write header.
        n, err := w.Write(hw.Bytes())
        if err != nil {
                totalBytes += n
                return totalBytes, err
        }
        totalBytes += n

        // Write payload.
        n, err = w.Write(payload)
        if err != nil {
                totalBytes += n
                return totalBytes, err
        }
        totalBytes += n

protocol.py fails with a short payload:
if (data_len - HEADER_LEN) < msg['length']:
self.required_len = HEADER_LEN + msg['length']
raise PayloadTooShortError("got {} of {} bytes".format(
data_len, HEADER_LEN + msg['length']))

If I add more debugging:

2014-02-28 15:02:25,683,683.5 DEBUG (connect) Payload: got 24 of 493 bytes:
msg {'checksum': '\xd4\x1d\xf7\xa2', 'length': 469, 'magic_number': '\xf9\xbe\xb4\xd9', 'command': 'inv'}

I believe you need to keep reading until there is no more data instead of erroring there.

@dajohi
Copy link
Author

dajohi commented Feb 28, 2014

24.247.20.162:8333 is a btcd node if you want to use that for testing.

@ayeowch ayeowch self-assigned this Feb 28, 2014
@ayeowch ayeowch added the bug label Feb 28, 2014
@ayeowch
Copy link
Owner

ayeowch commented Mar 1, 2014

Fixed with 22f2858

btcd nodes from the latest snapshot: http://getaddr.bitnodes.io/nodes/1393635900/?q=btcd%3A

@ayeowch ayeowch closed this as completed Mar 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants