Skip to content

Commit 0bdefa7

Browse files
committed
marketplace: simplify requestEnd()
1 parent 43f3650 commit 0bdefa7

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
@@ -460,19 +460,10 @@ contract Marketplace is SlotReservations, Proofs, StateRetrieval, Endian {
460460

461461
function requestEnd(RequestId requestId) public view returns (Timestamp) {
462462
RequestState state = requestState(requestId);
463-
if (
464-
state == RequestState.New ||
465-
state == RequestState.Started ||
466-
state == RequestState.Failed
467-
) {
468-
return _requestContexts[requestId].endsAt;
469-
}
470463
if (state == RequestState.Cancelled) {
471464
return _requestContexts[requestId].expiresAt;
472465
}
473-
Timestamp currentTime = Timestamps.currentTime();
474-
Timestamp end = _requestContexts[requestId].endsAt;
475-
return Timestamps.earliest(end, currentTime);
466+
return _requestContexts[requestId].endsAt;
476467
}
477468

478469
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)