bark: introduce locking on processing incoming mailbox messages

Concurrent consumers of mailbox messages could race and create duplicate movements (check test commit). We introduce a mailbox lock using the existing LockManager in bark.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented arkoor receives from being double-counted in wallet history when multiple mailbox sync consumers run concurrently for the same wallet.
    • Improved mailbox processing so checkpoints aren’t advanced when an arkoor message fails to process, ensuring consistent sync behavior.
  • Tests
    • Added a Tokio concurrency test to verify overlapping mailbox sync operations result in exactly one recorded movement (and one final VTXO) for the pending arkoor receive.
Edited by coderabbit

Merge request reports

Loading