mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
net: update misbehavior logging for oversized messages
so that oversized ADDR, GETDATA, HEADERS and INV messages print the same consistent debug logs.
This commit is contained in:
parent
5f72ddb7ee
commit
9fa494dc09
3 changed files with 7 additions and 7 deletions
|
|
@ -2454,7 +2454,7 @@ void ProcessMessage(
|
||||||
if (vAddr.size() > 1000)
|
if (vAddr.size() > 1000)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom.GetId(), 20, strprintf("message addr size() = %u", vAddr.size()));
|
Misbehaving(pfrom.GetId(), 20, strprintf("addr message size = %u", vAddr.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2530,7 +2530,7 @@ void ProcessMessage(
|
||||||
if (vInv.size() > MAX_INV_SZ)
|
if (vInv.size() > MAX_INV_SZ)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom.GetId(), 20, strprintf("message inv size() = %u", vInv.size()));
|
Misbehaving(pfrom.GetId(), 20, strprintf("inv message size = %u", vInv.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2596,7 +2596,7 @@ void ProcessMessage(
|
||||||
if (vInv.size() > MAX_INV_SZ)
|
if (vInv.size() > MAX_INV_SZ)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom.GetId(), 20, strprintf("message getdata size() = %u", vInv.size()));
|
Misbehaving(pfrom.GetId(), 20, strprintf("getdata message size = %u", vInv.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ class AddrTest(BitcoinTestFramework):
|
||||||
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
|
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
|
||||||
msg = msg_addr()
|
msg = msg_addr()
|
||||||
|
|
||||||
self.log.info('Send too large addr message')
|
self.log.info('Send too-large addr message')
|
||||||
msg.addrs = ADDRS * 101
|
msg.addrs = ADDRS * 101
|
||||||
with self.nodes[0].assert_debug_log(['message addr size() = 1010']):
|
with self.nodes[0].assert_debug_log(['addr message size = 1010']):
|
||||||
addr_source.send_and_ping(msg)
|
addr_source.send_and_ping(msg)
|
||||||
|
|
||||||
self.log.info('Check that addr message content is relayed and added to addrman')
|
self.log.info('Check that addr message content is relayed and added to addrman')
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,10 @@ class InvalidMessagesTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def test_large_inv(self):
|
def test_large_inv(self):
|
||||||
conn = self.nodes[0].add_p2p_connection(P2PInterface())
|
conn = self.nodes[0].add_p2p_connection(P2PInterface())
|
||||||
with self.nodes[0].assert_debug_log(['Misbehaving', '(0 -> 20): message inv size() = 50001']):
|
with self.nodes[0].assert_debug_log(['Misbehaving', '(0 -> 20): inv message size = 50001']):
|
||||||
msg = msg_inv([CInv(MSG_TX, 1)] * 50001)
|
msg = msg_inv([CInv(MSG_TX, 1)] * 50001)
|
||||||
conn.send_and_ping(msg)
|
conn.send_and_ping(msg)
|
||||||
with self.nodes[0].assert_debug_log(['Misbehaving', '(20 -> 40): message getdata size() = 50001']):
|
with self.nodes[0].assert_debug_log(['Misbehaving', '(20 -> 40): getdata message size = 50001']):
|
||||||
msg = msg_getdata([CInv(MSG_TX, 1)] * 50001)
|
msg = msg_getdata([CInv(MSG_TX, 1)] * 50001)
|
||||||
conn.send_and_ping(msg)
|
conn.send_and_ping(msg)
|
||||||
with self.nodes[0].assert_debug_log(['Misbehaving', '(40 -> 60): headers message size = 2001']):
|
with self.nodes[0].assert_debug_log(['Misbehaving', '(40 -> 60): headers message size = 2001']):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue