remove dependency on lighthouse for size

This commit is contained in:
Jeremy Kauffman 2017-09-20 09:38:24 -04:00
parent ef882b40b8
commit 4553418f98
2 changed files with 4 additions and 16 deletions

View file

@ -45,7 +45,7 @@ export function doFetchCostInfoForUri(uri) {
} else if (fee.currency == "LBC") {
resolve({ cost: fee.amount, includesData: true });
} else {
begin();
// begin();
lbryio.getExchangeRates().then(({ lbc_usd }) => {
resolve({ cost: fee.amount / lbc_usd, includesData: true });
});

View file

@ -207,24 +207,12 @@ lbry.getCostInfo = function(uri) {
return resolve(costInfoCache[uri]);
}
function getCost(uri, size) {
lbry
.stream_cost_estimate({ uri, ...(size !== null ? { size } : {}) })
.then(cost => {
cacheAndResolve(cost, size !== null);
}, reject);
}
const uriObj = lbryuri.parse(uri);
const name = uriObj.path || uriObj.name;
lighthouse.get_size_for_name(name).then(size => {
if (size) {
getCost(name, size);
} else {
getCost(name, null);
}
});
lbry.stream_cost_estimate({ uri }).then(cost => {
cacheAndResolve(cost, size !== null);
}, reject);
});
}
return lbry.costPromiseCache[uri];