Loading
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_locknow takes the expectedunlock_hashand checks it before sending forfeit signatures. Its caller inprogress_delegatedpasses the participation's hash, and so doesconstruct_new_vtxos.construct_new_vtxosskips 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_leavestolib/src/test_utilso 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_hashargument. - Not run:
cargo test -p bark-walletand the integration tests were not run for this description. Runcargo test -p bark-wallet roundbefore merging.