bdk icon indicating copy to clipboard operation
bdk copied to clipboard

test(chain): add several basic scenarios to test transaction conflicts

Open pluveto opened this issue 1 year ago • 9 comments

Description

This update introduces several test cases to validate the transaction conflict handling logic within the TxGraph. The tests encompass a range of scenarios including:

  1. Simple cases with isolated transactions (only A exists).
  2. Scenarios with conflicting transactions (B and B' spending A) under two basic conditions:
    • One of the conflicting transactions is confirmed.
    • Conflicts are resolved based on the last_seen timestamp.

Changelog Notice

  • Added unit tests for transaction conflict resolution in TxGraph.

Checklists

All Submissions:

  • [x] I've signed all my commits.
  • [x] I followed the contribution guidelines.
  • [x] I ran cargo fmt and cargo clippy before committing.

pluveto avatar Nov 21 '24 12:11 pluveto

Thank you for your contribution! The test case involving two conflicting transactions with different last_seen values is already addressed by the existing test scenario: "2 unconfirmed txs with same last_seens conflict." Other than that, the rest of the tests look good to me.

LagginTimes avatar Nov 23 '24 17:11 LagginTimes

OK. I've removed this redundant case.

pluveto avatar Nov 24 '24 03:11 pluveto

Could you please squash the second commit into the first one to keep the commit history clean? Everything will look good to me once that's done. Thanks!

LagginTimes avatar Nov 24 '24 08:11 LagginTimes

Squash done.

pluveto avatar Nov 25 '24 03:11 pluveto

@pluveto could you please rebase on master to fix CI? We just merged the fix for CI.

evanlinjin avatar Nov 25 '24 05:11 evanlinjin

Now it's rebased.

pluveto avatar Nov 25 '24 06:11 pluveto

ACK 8374f70b3428870a0ef5f77278329897464fee88

LagginTimes avatar Nov 25 '24 08:11 LagginTimes

ACK 7c3f915886881c7d50e7f02eaef2774e63d1a3dc

LagginTimes avatar Nov 27 '24 14:11 LagginTimes

Rebased

pluveto avatar Dec 03 '24 13:12 pluveto