mirror of
https://github.com/Rucknium/misc-research.git
synced 2024-11-16 15:58:03 +00:00
Enable remote node mempool archiver
This commit is contained in:
parent
566e661e61
commit
f0bd624811
1 changed files with 13 additions and 3 deletions
|
@ -1,4 +1,14 @@
|
|||
|
||||
script.args <- commandArgs(trailingOnly = TRUE)
|
||||
|
||||
stopifnot(length(script.args) <= 1)
|
||||
|
||||
if (length(script.args) == 1) {
|
||||
url.rpc <- script.args
|
||||
} else {
|
||||
url.rpc <- "http://127.0.0.1:18081"
|
||||
}
|
||||
|
||||
# Modified from TownforgeR::tf_rpc_curl function
|
||||
xmr.rpc <- function(
|
||||
url.rpc = "http://127.0.0.1:18081/json_rpc",
|
||||
|
@ -61,7 +71,7 @@ tx.pool <- c()
|
|||
|
||||
# Check that node is responding
|
||||
while(length(tx.pool) == 0) {
|
||||
tx.pool <- xmr.rpc("http://127.0.0.1:18081/get_transaction_pool")$transactions
|
||||
tx.pool <- xmr.rpc(paste0(url.rpc, "/get_transaction_pool"))$transactions
|
||||
|
||||
if (length(tx.pool) > 0 && tx.pool[[1]]$receive_time == 0) {
|
||||
error("Transaction receive_time is missing. Possible solution: remove '--restricted-rpc' monerod flag.")
|
||||
|
@ -78,9 +88,9 @@ while (TRUE) {
|
|||
|
||||
compute.time <- system.time({
|
||||
|
||||
tx.pool <- xmr.rpc("http://127.0.0.1:18081/get_transaction_pool", keep.trying.rpc = TRUE)$transactions
|
||||
tx.pool <- xmr.rpc(paste0(url.rpc, "/get_transaction_pool"), keep.trying.rpc = TRUE)$transactions
|
||||
|
||||
block.header <- xmr.rpc(url.rpc = "http://127.0.0.1:18081/json_rpc", method = "get_last_block_header")$result$block_header
|
||||
block.header <- xmr.rpc(paste0(url.rpc, "/json_rpc"), method = "get_last_block_header")$result$block_header
|
||||
|
||||
block_receive_time <- round(Sys.time())
|
||||
# One second time resolution
|
||||
|
|
Loading…
Reference in a new issue