marketplace: clarify why we flow & transfer funds before burning

Co-Authored-By: Adam Uhlíř <adam@uhlir.dev>
This commit is contained in:
Mark Spanbroek 2025-05-27 13:07:10 +02:00
parent 895e36fbba
commit 075d97e5da

View File

@ -364,8 +364,16 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
FundId fund = requestId.asFundId();
AccountId hostAccount = _vault.hostAccount(slot.host, slot.slotIndex);
AccountId clientAccount = _vault.clientAccount(request.client);
// ensure that nothing is flowing into the account anymore by reversing the
// incoming flow from the client
_vault.flow(fund, hostAccount, clientAccount, rate);
// temporarily transfer repair reward for the slot to the client until a
// host repairs the slot
_vault.transfer(fund, hostAccount, clientAccount, repairReward);
// burn the rest of the funds in the account
_vault.burnAccount(fund, hostAccount);
_removeFromMySlots(slot.host, slotId);