Skip to content

Commit 55fb29f

Browse files
committed
marketplace: simplify requestEnd()
1 parent 8a11e87 commit 55fb29f

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

contracts/Marketplace.sol

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,19 +464,10 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
464464

465465
function requestEnd(RequestId requestId) public view returns (Timestamp) {
466466
RequestState state = requestState(requestId);
467-
if (
468-
state == RequestState.New ||
469-
state == RequestState.Started ||
470-
state == RequestState.Failed
471-
) {
472-
return _requestContexts[requestId].endsAt;
473-
}
474467
if (state == RequestState.Cancelled) {
475468
return _requestContexts[requestId].expiresAt;
476469
}
477-
Timestamp currentTime = Timestamps.currentTime();
478-
Timestamp end = _requestContexts[requestId].endsAt;
479-
return Timestamps.earliest(end, currentTime);
470+
return _requestContexts[requestId].endsAt;
480471
}
481472

482473
function requestExpiry(RequestId requestId) public view returns (Timestamp) {

contracts/Timestamps.sol

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,4 @@ library Timestamps {
6767
) internal pure returns (Duration) {
6868
return Duration.wrap(Timestamp.unwrap(end) - Timestamp.unwrap(start));
6969
}
70-
71-
/// Returns the earliest of the two timestamps
72-
function earliest(
73-
Timestamp a,
74-
Timestamp b
75-
) internal pure returns (Timestamp) {
76-
if (a <= b) {
77-
return a;
78-
} else {
79-
return b;
80-
}
81-
}
8270
}

0 commit comments

Comments
 (0)