Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: burned reorg #4697

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,10 @@ impl LMDBDatabase {
if inputs.iter().any(|r| r.input.output_hash() == output_hash) {
continue;
}
// if an output was burned, it was never created as an unspent utxo
if output.is_burned() {
continue;
}
lmdb_delete(
txn,
&*self.utxo_commitment_index,
Expand Down
29 changes: 29 additions & 0 deletions integration_tests/features/Reorgs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ Feature: Reorgs
And node B is at height 10
And node C is at height 10


@critical
Scenario: Simple reorg with burned output
# Chain 1
# Note: Use more than 1 base node to speed up the test
Given I have a seed node SEED_B
And I have a base node B connected to seed SEED_B
And I have wallet WB connected to base node B
And I have mining node BM connected to base node B and wallet WB
And mining node BM mines 10 blocks with min difficulty 1 and max difficulty 1

When I wait for wallet WB to have at least 55000000000 uT
When I create a burn transaction of 1000000 uT from WB at fee 100
And mining node BM mines 5 blocks with min difficulty 1 and max difficulty 1
# Chain 2
# Note: Use more than 1 base node to speed up the test
Given I have a seed node SEED_C
And I have a base node C connected to seed SEED_C
And I have wallet WC connected to base node C
And I have mining node CM connected to base node C and wallet WC
And mining node CM mines 17 blocks with min difficulty 1 and max difficulty 1
# Connect chain 1 and 2
Then node B is at height 15
And node C is at height 17
Given I have a base node SA connected to nodes B,C
Then node SA is at height 17
And node B is at height 17
And node C is at height 17

@critical
Scenario: Node rolls back reorg on invalid block
Given I have a seed node SA
Expand Down