Skip to content

Fix Localbitcoins fallback strategy - #297

Merged
lilienblum merged 5 commits into
redesignfrom
fix_localbitcoins_rate
Jan 17, 2020
Merged

lilienblum merged 5 commits into
redesignfrom
fix_localbitcoins_rate

Conversation

@lilienblum

@lilienblum lilienblum commented Jan 9, 2020 •

Copy link
Copy Markdown
Contributor

Missing slash caused HTTP 301
Also USDC caption added because BitPay added USDC rate to the response
No need to update okhttp so far

@HashEngineering HashEngineering left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019-12-27 08:39:33.012 7586-7684/hashengineering.darkcoin.wallet_test E/ExchangeRatesRepository: [pool-7-thread-1] failed to fetch exchange rates with de.schildbach.wallet.rates.DashRatesSecondFallback@66202c8
    java.lang.NullPointerException: throw with null exception
    	at de.schildbach.wallet.rates.LocalBitcoinsRate.getAvg1h(Unknown Source:3) ~[na:0.0]
    	at de.schildbach.wallet.rates.LocalBitcoinsResponse.getDashVesPrice(LocalBitcoinsResponse.java:17) ~[na:0.0]
    	at de.schildbach.wallet.rates.DashRatesSecondFallback.getRates(DashRatesSecondFallback.java:36) ~[na:0.0]
    	at de.schildbach.wallet.rates.ExchangeRatesRepository$1.run(ExchangeRatesRepository.java:85) ~[na:0.0]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) ~[na:0.0]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) ~[na:0.0]
    	at java.lang.Thread.run(Thread.java:764) ~[na:0.0]

I am still getting the above exception in the logs and the Local Currencies list is empty if the first three price sources are commented out.

I will defer to @sambarboza and @tomasz-ludek

I also tried running #222 which upgrades okhttp, but that didn't work either.

Edit: The exception from the log was incorrect on the previous post.

@lilienblum

Copy link
Copy Markdown
Contributor Author

@HashEngineering please give it a try with the last commit (updated okhttp3). I assume it might be the source of different problem which can be reproducible only on specific Android devices/os versions

@HashEngineering

Copy link
Copy Markdown
Collaborator

@denlb
I agree that this could be related to android version

I tried this updated PR on Android 8.1 and 9.0 and both result in no exchange rates and the same exception.

However, if the call to LocalBitcoins is removed, then all rates are obtained and this ends up in the log:
I/ExchangeRatesRepository: [pool-8-thread-1] exchange rates updated successfully with de.schildbach.wallet.rates.DashRatesSecondFallback@569f7b7. Of course, the VES price is incorrect.

I don't understand why its only the LocalBitcoins reponse that gives this error / exception, while all other calls work fine.

@lilienblum

Copy link
Copy Markdown
Contributor Author

@HashEngineering please try again with the last commit, I've fixed another serializer problem. Should work now:

image

@HashEngineering

Copy link
Copy Markdown
Collaborator

This appears to be working.

The rates are retrieved.

This PR will also superceed #222.

@HashEngineering HashEngineering left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one change with the USDC coin to make.

Otherwise the changes made resolve the issue.

}
if (currencyCode.equalsIgnoreCase("USDC")) {
return "USD Coin (USDC)";
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be handled by #302 . Can you remove this?

Also it appears that there are many other currencies without names in the list.

Other currencies from bitpay:
XRP, PAX, MRU,

Some currencies appear to crash the app. I will try to handle that in #302 also.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HashEngineering
HashEngineering self-requested a review January 17, 2020 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants