Skip to content

Commit

Permalink
fix(pallet-market): settle_deal_payments should return provider's col…
Browse files Browse the repository at this point in the history
…lateral after deal is finished without slashing
  • Loading branch information
th7nder authored and jmg-duarte committed Jul 22, 2024
1 parent 5457501 commit a0c3950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pallets/market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ pub mod pallet {

// NOTE(@jmg-duarte,28/06/2024): Maybe emit an event when the table is updated?
if complete_deal {
unlock_funds::<T>(&deal_proposal.provider, deal_proposal.provider_collateral)?;
Proposals::<T>::remove(deal_id);
} else {
// Otherwise, we update the proposal — `last_updated_block`
Expand Down
4 changes: 2 additions & 2 deletions pallets/market/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,8 @@ fn settle_deal_payments_success_finished() {
assert_eq!(
BalanceTable::<Test>::get(account::<Test>(PROVIDER)),
BalanceEntry::<u64> {
free: 50 + 5 * 10, // 50 (from 75 - collateral) + (price per block * n blocks)
locked: 25
free: 75 + 5 * 10, // 50 (from 75 - collateral + returned collateral (not slashed)) + (price per block * n blocks)
locked: 0
}
);

Expand Down

0 comments on commit a0c3950

Please sign in to comment.