lbryio / spee.ch

An image hosting service on top of the LBRY protocol.
https://spee.ch
MIT License
185 stars 78 forks source link

claimAvailability treats abandoned claim names as unavailable on publish #1033

Open jessopb opened 5 years ago

jessopb commented 5 years ago

Most queries in chainquery claimQueries restrict queries:

const whereClause = bidState || {
      [sequelize.Op.or]: [
        { bid_state: 'Controlling' },
        { bid_state: 'Active' },
        { bid_state: 'Accepted' },
      ],
    };

checkClaimAvailability has it's own chainquery.claim query:

  return chainquery.claim
    .findAll({
      attributes: ['claim_address'],
      where     : {
        name,
        claim_address: {
          [Op.or]: claimAddresses,
        },
      },
    })
    .then(result => {
      return (result.length <= 0);
    })
    .catch(error => {
      throw error;
    });

That causes claims to show as reserved names even when abandoned. This query could probably be moved into claim queries with the rest of them.