Performance and param URL tweaks
This commit is contained in:
@@ -37,24 +37,24 @@ object ZcashSdk {
|
|||||||
// Because blocks are buffered in memory upon download and storage into SQLite, there is an upper bound
|
// Because blocks are buffered in memory upon download and storage into SQLite, there is an upper bound
|
||||||
// above which OutOfMemoryError is thrown. Experimentally, this value is below 50 blocks.
|
// above which OutOfMemoryError is thrown. Experimentally, this value is below 50 blocks.
|
||||||
// Back of the envelope calculation says the maximum block size is ~100kb.
|
// Back of the envelope calculation says the maximum block size is ~100kb.
|
||||||
const val DOWNLOAD_BATCH_SIZE = 10
|
const val DOWNLOAD_BATCH_SIZE = 50
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default size of batches of blocks to scan via librustzcash. The smaller this number the more granular information
|
* Default size of batches of blocks to scan via librustzcash. The smaller this number the more granular information
|
||||||
* can be provided about scan state. Unfortunately, it may also lead to a lot of overhead during scanning.
|
* can be provided about scan state. Unfortunately, it may also lead to a lot of overhead during scanning.
|
||||||
*/
|
*/
|
||||||
val SCAN_BATCH_SIZE = 150
|
val SCAN_BATCH_SIZE = 500
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default amount of time, in milliseconds, to poll for new blocks. Typically, this should be about half the average
|
* Default amount of time, in milliseconds, to poll for new blocks. Typically, this should be about half the average
|
||||||
* block time.
|
* block time.
|
||||||
*/
|
*/
|
||||||
val POLL_INTERVAL = 20_000L
|
val POLL_INTERVAL = 18_000L
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimate of the time between blocks.
|
* Estimate of the time between blocks.
|
||||||
*/
|
*/
|
||||||
val BLOCK_INTERVAL_MILLIS = 75_000L
|
val BLOCK_INTERVAL_MILLIS = 36_000L
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default attempts at retrying.
|
* Default attempts at retrying.
|
||||||
@@ -87,11 +87,13 @@ object ZcashSdk {
|
|||||||
val OUTPUT_PARAM_FILE_NAME = "sapling-output.params"
|
val OUTPUT_PARAM_FILE_NAME = "sapling-output.params"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Url that is used by default in zcashd.
|
* The Url that is used by default in hushd.
|
||||||
* We'll want to make this externally configurable, rather than baking it into the SDK but
|
* We'll want to make this externally configurable, rather than baking it into the SDK but
|
||||||
* this will do for now, since we're using a cloudfront URL that already redirects.
|
* this will do for now
|
||||||
*/
|
*/
|
||||||
val CLOUD_PARAM_DIR_URL = "https://z.cash/downloads/"
|
val CLOUD_PARAM_DIR_URL = listOf("https://git.hush.is/hush/hush3/raw/branch/master/",
|
||||||
|
"https://github.com/hushmirror/hush3/raw/dev/")
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default memo to use when shielding transparent funds.
|
* The default memo to use when shielding transparent funds.
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ class SaplingParamTool {
|
|||||||
ZcashSdk.SPEND_PARAM_FILE_NAME,
|
ZcashSdk.SPEND_PARAM_FILE_NAME,
|
||||||
ZcashSdk.OUTPUT_PARAM_FILE_NAME
|
ZcashSdk.OUTPUT_PARAM_FILE_NAME
|
||||||
).forEach { paramFileName ->
|
).forEach { paramFileName ->
|
||||||
val url = "${ZcashSdk.CLOUD_PARAM_DIR_URL}/$paramFileName"
|
val url = "${ZcashSdk.CLOUD_PARAM_DIR_URL.random()}/$paramFileName"
|
||||||
|
twig("Downloading Sapling params from ${url}...")
|
||||||
val request = Request.Builder().url(url).build()
|
val request = Request.Builder().url(url).build()
|
||||||
val response = withContext(Dispatchers.IO) { client.newCall(request).execute() }
|
val response = withContext(Dispatchers.IO) { client.newCall(request).execute() }
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
|
|||||||
Reference in New Issue
Block a user