mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 00:10:45 +00:00
Adds mempool to verify OTS via Tor.
This commit is contained in:
parent
ff9f25ccdb
commit
c7b7ad78b7
@ -48,7 +48,8 @@ class OkHttpBlockstreamExplorer(
|
||||
return it
|
||||
}
|
||||
|
||||
val url = "$BLOCKSTREAM_API_URL/block/$hash"
|
||||
val usingTor = forceProxy(BLOCKSTREAM_API_URL)
|
||||
val url = "${getAPI(usingTor)}/block/$hash"
|
||||
val client = HttpClientManager.getHttpClient(forceProxy(url))
|
||||
|
||||
val request =
|
||||
@ -92,8 +93,9 @@ class OkHttpBlockstreamExplorer(
|
||||
return it
|
||||
}
|
||||
|
||||
val url = "$BLOCKSTREAM_API_URL/block-height/$height"
|
||||
val client = HttpClientManager.getHttpClient(forceProxy(url))
|
||||
val usingTor = forceProxy(BLOCKSTREAM_API_URL)
|
||||
val url = "${getAPI(usingTor)}/block-height/$height"
|
||||
val client = HttpClientManager.getHttpClient(usingTor)
|
||||
|
||||
val request =
|
||||
Request
|
||||
@ -119,5 +121,13 @@ class OkHttpBlockstreamExplorer(
|
||||
|
||||
companion object {
|
||||
private const val BLOCKSTREAM_API_URL = "https://blockstream.info/api"
|
||||
private const val MEMPOOL_API_URL = "https://mempool.space/api/"
|
||||
|
||||
fun getAPI(usingTor: Boolean) =
|
||||
if (usingTor) {
|
||||
MEMPOOL_API_URL
|
||||
} else {
|
||||
BLOCKSTREAM_API_URL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,8 +379,8 @@ public class OpenTimestamps {
|
||||
|
||||
try {
|
||||
String blockHash = explorer.blockHash(height);
|
||||
blockInfo = explorer.block(blockHash);
|
||||
Log.i("OpenTimestamps", "Lite-client verification, assuming block " + blockHash + " is valid");
|
||||
blockInfo = explorer.block(blockHash);
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
throw e2;
|
||||
|
Loading…
Reference in New Issue
Block a user