Skip to content

Commit

Permalink
Add test case and release notes for auto finalization
Browse files Browse the repository at this point in the history
Summary:
As per title.

Depends on D2102

Test Plan:
  make check
  ./test/functional/test_runner.py abc-finalize-block

Reviewers: #bitcoin_abc, schancel, jasonbcox

Reviewed By: #bitcoin_abc, schancel, jasonbcox

Subscribers: jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D2106
  • Loading branch information
deadalnix committed Nov 20, 2018
1 parent 917d657 commit d1d091b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ Bitcoin ABC version 0.18.5 is now available from:
<https://download.bitcoinabc.org/0.18.5/>

This release includes the following features and fixes:
- Add the finalized block concept. Finalized blocks cannot be reorged, which protects the network against deep reorgs.
- Add the `-maxreorgdepth` configuration to configure at what depth block are considered final. Default is 10. Use -1 to disable.
- Introduce `finalizeblock` RPC to finalize a block at the will of the node operator.
- Introduce a penalty to alternative chains based on the depth of the fork. This makes it harder for an attacker to do mid size reorg.
10 changes: 8 additions & 2 deletions test/functional/abc-finalize-block.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def run_test(self):
alt_node.generate(10)

# Wait for node 0 to invalidate the chain.
def wait_for_invalid_block(block):
def wait_for_invalid_block(node, block):
def check_block():
for tip in node.getchaintips():
if tip["hash"] == block:
Expand All @@ -51,7 +51,13 @@ def check_block():
return False
wait_until(check_block)

wait_for_invalid_block(alt_node.getbestblockhash())
# node do not accept alt_node's chain due to tip being finalized,
# even though it is longer.
wait_for_invalid_block(node, alt_node.getbestblockhash())
assert_equal(node.getbestblockhash(), tip)

# alt_node has mined 10 block, so tip must be invalid due to finalization.
wait_for_invalid_block(alt_node, tip)

self.log.info("Test that an invalid block cannot be finalized...")
assert_raises_rpc_error(-20, RPC_FINALIZE_INVALID_BLOCK_ERROR,
Expand Down

0 comments on commit d1d091b

Please sign in to comment.