mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 19:01:41 +02:00
[refactor] Add useful-for-dos "reason" field to CValidationState
This is a first step towards cleaning up our DoS interface - make validation return *why* something is invalid, and let net_processing figure out what that implies in terms of banning/disconnection/etc. Behavior change: peers will now be banned for providing blocks with premature coinbase spends. Co-authored-by: Anthony Towns <aj@erisian.com.au> Suhas Daftuar <sdaftuar@gmail.com>
This commit is contained in:
committed by
Suhas Daftuar
parent
6a7f8777a0
commit
34477ccd39
@@ -295,7 +295,7 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
self.log.info("Reject a block spending an immature coinbase.")
|
||||
self.move_tip(15)
|
||||
b20 = self.next_block(20, spend=out[7])
|
||||
self.send_blocks([b20], success=False, reject_reason='bad-txns-premature-spend-of-coinbase')
|
||||
self.send_blocks([b20], success=False, reject_reason='bad-txns-premature-spend-of-coinbase', reconnect=True)
|
||||
|
||||
# Attempt to spend a coinbase at depth too low (on a fork this time)
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
@@ -308,7 +308,7 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
self.send_blocks([b21], False)
|
||||
|
||||
b22 = self.next_block(22, spend=out[5])
|
||||
self.send_blocks([b22], success=False, reject_reason='bad-txns-premature-spend-of-coinbase')
|
||||
self.send_blocks([b22], success=False, reject_reason='bad-txns-premature-spend-of-coinbase', reconnect=True)
|
||||
|
||||
# Create a block on either side of MAX_BLOCK_BASE_SIZE and make sure its accepted/rejected
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
|
Reference in New Issue
Block a user