Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: realnowhereman on May 25, 2011, 12:34:00 PM



Title: Tiny error in shy version message code
Post by: realnowhereman on May 25, 2011, 12:34:00 PM
Code:
0c97aa9e141f5:main.cpp:2388

        // Be shy and don't send version until we hear
        if (pfrom->fInbound)
            pfrom->PushVersion();

Shouldn't this be !pfrom->fInbound ?

Outbound connections should speak first, but this code makes inbound connections speak first.

I admit I don't really know what's going on since the following is present too:

Code:
0c97aa9e141f5:net.h:567

        // Be shy and don't send version until we hear
        if (!fInbound)
            PushVersion();

Which looks more correct to me.


Title: Re: Tiny error in shy version message code
Post by: Hal on May 25, 2011, 08:19:14 PM
I'm the author of this code. The main.cpp code sends a version message in response to receiving one, on inbound connections.


Title: Re: Tiny error in shy version message code
Post by: realnowhereman on May 26, 2011, 06:12:54 AM
Of course.  Feeling dim now.