bark: require delegated round VTXOs to be locked by our unlock hash

Summary

  • Reject a new round VTXO in the delegated flow unless its terminal hash-locked transition uses the unlock hash the server returned for our participation (VUL-153).
  • check_vtxo_fails_hash_lock now takes the expected unlock_hash and checks it before sending forfeit signatures. Its caller in progress_delegated passes the participation's hash, and so does construct_new_vtxos.
  • construct_new_vtxos skips tree leaves locked by another unlock hash, so a leaf that matches one of our outputs on policy and amount is not mistaken for ours.
  • Add build_signed_tree_with_leaves to lib/src/test_util so tests can build trees where each leaf has its own unlock hash.

Testing

  • Added rejects_round_vtxo_locked_by_another_unlock_hash: for both hashlock versions (V0, V1), a leaf locked by another hash is accepted with the right hash and rejected with ours.
  • Added new_vtxos_skip_leaves_locked_by_another_unlock_hash: a foreign-locked leaf that appears first and matches our output is skipped, and only our leaf is returned.
  • Updated the existing hash-lock tests for the new unlock_hash argument.
  • Not run: cargo test -p bark-wallet and the integration tests were not run for this description. Run cargo test -p bark-wallet round before merging.

Merge request reports

Loading
Loading