diff options
| author | Troy Giorshev <[email protected]> | 2020-06-04 11:49:09 -0400 |
|---|---|---|
| committer | Troy Giorshev <[email protected]> | 2020-06-08 00:54:43 -0400 |
| commit | 57890abf2c7919eddfec36178b1136cd44ffe883 (patch) | |
| tree | 07d9c7370e0fe9478722698271e75d3c919b5f4a /src/httpserver.cpp | |
| parent | Merge #19202: log: remove deprecated `db` log category (diff) | |
| download | discoin-57890abf2c7919eddfec36178b1136cd44ffe883.tar.xz discoin-57890abf2c7919eddfec36178b1136cd44ffe883.zip | |
Remove two unneeded tests
Test 1 is a duplicate of test_size() later in the file. Inexplicably,
this test does not work on macOS, whereas test_size() does.
Test 2 is problematic for two reasons. First, it always fails with an
invalid checksum, which is probably not what was intended. Second, it's
not defined at this layer what the behavior should be. Hypothetically,
if this test was fixed so that it gave messages with valid checksums,
then the message would pass successfully thought the network layer and
fail only in the processing layer. A priori the network layer has no
idea what the size of a message "actually" is.
The "Why does behavior change at 78 bytes" is because of the following:
print(len(node.p2p.build_message(msg))) # 125
=> Payload size = 125 - 24 = 101
If we take 77 bytes, then there are 101 - 77 = 24 left
That's exactly the size of a header
So, bitcoind deserializes the header and rejects it for some other reason
(Almost always an invalid size (too large))
But, if we take 78 bytes, then there are 101 - 78 = 23 left
That's not enough to fill a header, so the socket stays open waiting for
more data. That's why we sometimes have to push additional data in
order for the peer to disconnect.
Additionally, both of these tests use the "conn" variable. For fun, go
look at where it's declared. (Hint: test_large_inv(). Don't we all
love python's idea of scope?)
Diffstat (limited to 'src/httpserver.cpp')
0 files changed, 0 insertions, 0 deletions