mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 18:51:15 +02:00
Utilize anti-DoS headers download strategy
Avoid permanently storing headers from a peer, unless the headers are part of a chain with sufficiently high work. This prevents memory attacks using low-work headers. Designed and co-authored with Pieter Wuille.
This commit is contained in:
@ -22,6 +22,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.chain = 'testnet3' # Use testnet chain because it has an early checkpoint
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [["-minimumchainwork=0x0"], ["-minimumchainwork=0x0"]]
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_argument(
|
||||
@ -62,7 +63,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("Feed all fork headers (succeeds without checkpoint)")
|
||||
# On node 0 it succeeds because checkpoints are disabled
|
||||
self.restart_node(0, extra_args=['-nocheckpoints'])
|
||||
self.restart_node(0, extra_args=['-nocheckpoints', "-minimumchainwork=0x0"])
|
||||
peer_no_checkpoint = self.nodes[0].add_p2p_connection(P2PInterface())
|
||||
peer_no_checkpoint.send_and_ping(msg_headers(self.headers_fork))
|
||||
assert {
|
||||
|
Reference in New Issue
Block a user