mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 22:53:11 +02:00
Adds mempool to verify OTS via Tor.
This commit is contained in:
@@ -48,7 +48,8 @@ class OkHttpBlockstreamExplorer(
|
|||||||
return it
|
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 client = HttpClientManager.getHttpClient(forceProxy(url))
|
||||||
|
|
||||||
val request =
|
val request =
|
||||||
@@ -92,8 +93,9 @@ class OkHttpBlockstreamExplorer(
|
|||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
|
|
||||||
val url = "$BLOCKSTREAM_API_URL/block-height/$height"
|
val usingTor = forceProxy(BLOCKSTREAM_API_URL)
|
||||||
val client = HttpClientManager.getHttpClient(forceProxy(url))
|
val url = "${getAPI(usingTor)}/block-height/$height"
|
||||||
|
val client = HttpClientManager.getHttpClient(usingTor)
|
||||||
|
|
||||||
val request =
|
val request =
|
||||||
Request
|
Request
|
||||||
@@ -119,5 +121,13 @@ class OkHttpBlockstreamExplorer(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val BLOCKSTREAM_API_URL = "https://blockstream.info/api"
|
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 {
|
try {
|
||||||
String blockHash = explorer.blockHash(height);
|
String blockHash = explorer.blockHash(height);
|
||||||
blockInfo = explorer.block(blockHash);
|
|
||||||
Log.i("OpenTimestamps", "Lite-client verification, assuming block " + blockHash + " is valid");
|
Log.i("OpenTimestamps", "Lite-client verification, assuming block " + blockHash + " is valid");
|
||||||
|
blockInfo = explorer.block(blockHash);
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
throw e2;
|
throw e2;
|
||||||
|
Reference in New Issue
Block a user