Skip to content

Conversation

@kevkevinpal
Copy link
Contributor

This resolves #5

Description

This change introduces a check of the getmempoolinfo rpc to check if the mempool is loaded

If the mempool is not loaded, it doesn't make sense to take an empty array as the response, as that is inaccurate. Instead we should get the No fee estimates available yet error as a response.

Also, an error is thrown, here is the log message

2025-08-12 09:12:03.317 [mempool-collector] ERROR x.b.a.service.MempoolCollector - Error updating fee estimates
java.lang.Exception: RPC error (mempool-info): mempool is not loaded
        at xyz.block.augurref.bitcoin.BitcoinRpcClient.getHeightAndMempoolTransactions(BitcoinRpcClient.kt:106)
        at xyz.block.augurref.service.MempoolCollector.updateFeeEstimates(MempoolCollector.kt:181)
        at xyz.block.augurref.service.MempoolCollector.access$updateFeeEstimates(MempoolCollector.kt:34)
        at xyz.block.augurref.service.MempoolCollector$start$$inlined$fixedRateTimer$default$1.run(Timer.kt:149)
        at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
        at java.base/java.util.TimerThread.run(Timer.java:516)

How to reproduce

in order to reproduce the error, run -txindex on bitcoind (note it will take about 2 days to reindex)
Then after 6ish hours of both Augur and bitcoind running this is the response Augur will return

{
  "mempool_update_time" : "2025-08-03T16:01:16.626Z",
  "estimates" : {
    "3" : {
      "probabilities" : { }
    },
    "6" : {
      "probabilities" : { }
    },
    "9" : {
      "probabilities" : { }
    },
    "12" : {
      "probabilities" : { }
    },
    "18" : {
      "probabilities" : { }
    },
    "24" : {
      "probabilities" : { }
    },
    "36" : {
      "probabilities" : { }
    },
    "48" : {
      "probabilities" : { }
    },
    "72" : {
      "probabilities" : { }
    },
    "96" : {
      "probabilities" : { }
    },
    "144" : {
      "probabilities" : { }
    }
  }
}

This is the response bitcoind will return for getmempoolinfo and getrawmempool

bitcoin-cli getmempoolinfo
{
  "loaded": false,
  "size": 0,
  "bytes": 0,
  "usage": 0,
  "total_fee": 0.00000000,
  "maxmempool": 300000000,
  "mempoolminfee": 0.00000100,
  "minrelaytxfee": 0.00000100,
  "incrementalrelayfee": 0.00000100,
  "unbroadcastcount": 0,
  "fullrbf": false
}

bitcoin-cli getrawmempool
[
]

…pty array

Signed-off-by: kevkevinpal <oapallikunnel@gmail.com>
@kevkevinpal kevkevinpal force-pushed the validateMempoolIsLoaded branch from 355033c to be9d80a Compare August 12, 2025 13:16
@kevkevinpal
Copy link
Contributor Author

My node is still reindexing, so I have not checked that this works after it's complete yet

will check again in a day probably

@laurenshareshian
Copy link
Collaborator

My node is still reindexing, so I have not checked that this works after it's complete yet

will check again in a day probably

Cool, let us know when you confirm.

On the one hand, I could see putting this mempool sync check inside the startup method instead of calling it every 30 seconds. One could argue that a minimum requirement to use augur is a synced node. On the other hand, making this one extra call probably doesn't affect performance too much so if it's helpful to the user then maybe it's fine to make this call regularly. @sanket1729 or @rloomba do you have an opinion?

@kevkevinpal
Copy link
Contributor Author

My node is still reindexing, so I have not checked that this works after it's complete yet
will check again in a day probably

Cool, let us know when you confirm.

I was able to test and it is working for me once synced.

On the one hand, I could see putting this mempool sync check inside the startup method instead of calling it every 30 seconds. One could argue that a minimum requirement to use augur is a synced node. On the other hand, making this one extra call probably doesn't affect performance too much so if it's helpful to the user then maybe it's fine to make this call regularly. @sanket1729 or @rloomba do you have an opinion?

The only issue I can think of if we check only at startup is if something happens to bitcoind while Augur is running then we will arrive at the same issue. I do agree that calling getmempoolinfo every 30 seconds is a bit redundant. Maybe we can call only if getrawmempool is giving an empty array?

@laurenshareshian
Copy link
Collaborator

My node is still reindexing, so I have not checked that this works after it's complete yet
will check again in a day probably

Cool, let us know when you confirm.

I was able to test and it is working for me once synced.

On the one hand, I could see putting this mempool sync check inside the startup method instead of calling it every 30 seconds. One could argue that a minimum requirement to use augur is a synced node. On the other hand, making this one extra call probably doesn't affect performance too much so if it's helpful to the user then maybe it's fine to make this call regularly. @sanket1729 or @rloomba do you have an opinion?

The only issue I can think of if we check only at startup is if something happens to bitcoind while Augur is running then we will arrive at the same issue. I do agree that calling getmempoolinfo every 30 seconds is a bit redundant. Maybe we can call only if getrawmempool is giving an empty array?

Maybe we can call only if getrawmempool is giving an empty array?
Yes! Great idea!

@kevkevinpal
Copy link
Contributor Author

ok I realized we should probably be doing getnetworkinfo instead and then checking localrelay since the mempool can be loaded in getmempoolinfo but not relaying transactions

@kevkevinpal
Copy link
Contributor Author

I'm going to think about this one a bit more just to make sure there are not any weird cases where a nodes mempool is empty and how to properly detect if it is accepting relayed transactions

@laurenshareshian
Copy link
Collaborator

I'm going to think about this one a bit more just to make sure there are not any weird cases where a nodes mempool is empty and how to properly detect if it is accepting relayed transactions

Okay cool yeah take your time! We've also been mostly thinking about this reference repo as a good way to get folks started and not be too complex (i.e., there will probably be edge cases unaccounted for and it won't be fully production ready). Therefore, if this edge case ends up being too much of a pain, no worries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Unexpected response when bitcoind is syncing

2 participants