Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #246 from ar-io/reserved-name-fix
Browse files Browse the repository at this point in the history
fix(reserved): mark name as reserved if it does not have an endtimestamp
  • Loading branch information
dtfiedler authored May 22, 2024
2 parents ff5eee4 + 6f9e9f7 commit bbef928
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/actions/write/buyRecord.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('buyRecord', () => {
);

it.each([['a-expired-reserved-name', 'not-short-name', 'reserved']])(
'should be able to buy a record of a reserved name when the caller is the target of the reserved name',
'should be able to buy a record of a reserved name when the caller is not the target of the reserved name but it is expired',
async (reservedName: string) => {
const initialState = {
...getBaselineState(),
Expand Down
4 changes: 3 additions & 1 deletion src/records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ export function isActiveReservedName({

const isCallerTarget = caller !== undefined && target === caller;
const isActiveReservation =
endTimestamp && endTimestamp > currentBlockTimestamp.valueOf();
endTimestamp === undefined ||
(endTimestamp !== undefined &&
endTimestamp > currentBlockTimestamp.valueOf());

// if the caller is not the target, and it's still active - the name is considered reserved
if (!isCallerTarget && isActiveReservation) {
Expand Down

0 comments on commit bbef928

Please sign in to comment.