As of 0.15.0.0, and 0.15.0.1, the getrawtransaction call lags when requesting non-existent transaction IDs.
Tested on Ubuntu 14.04 and 16.04.
Reproduce with:
$ bitcoin-cli getrawtransaction `openssl rand -hex 32` 1
As of 0.15.0.0, and 0.15.0.1, the getrawtransaction call lags when requesting non-existent transaction IDs.
Tested on Ubuntu 14.04 and 16.04.
Reproduce with:
$ bitcoin-cli getrawtransaction `openssl rand -hex 32` 1
Lags by how much? It's almost an instant response for me.
Also, what did you expect? The transaction index (if you have that enabled for getrawtransaction to be useful) is massive. It's not exactly going to be a fast operation since it has to search through the entire index to find your nonexistent transaction. Although I have txindex enabled on my node and it returned a response almost immediately.
If it's as intended, that's fine. But large services doing lookups for user-entered inputs will suffer.
You can close this if it's not going to be fixed.
The issue was introduced in the 0.15.x branch.
I am unable to reproduce your issue, so it does not even seem like there is an issue here. We can't fix a bug for which we cannot reproduce and have no debugging information for. Please provide more information if you think there is a bug.
Information that would be useful: Do you have txindex enabled? How long is the lag?
I missed that :)
Lag for a single non-existent transaction is between 0.321s and 0.350s. This is not fine. Lag for a single valid transaction is between 0.004s and 0.005s. Tested with size: 225b. This is fine.
txindex is enabled. Above results hold with and without re-indexing post upgrade to 0.15.
Highest machine configuration with the above results:
Ubuntu 16.04 8 CPUs 24GB RAM, 10GB free
I see. This is a side effect of the new UTXO database structure. The slowdown is on searching the UTXO set for the txid, not on txindex. I think it can be sped up, but that may take a bit of work to do. Because the UTXO database is now keyed on the outpoint (txid hash and output index), we have to search through all possible outpoints for a given txid which is slower than previously which was keyed on only the txid. I'll see if it can be sped up.
This seems expected when you don't have txindex one, but with it it seems easy to avoid.
This seems expected when you don't have txindex one, but with it it seems easy to avoid.
Is it not possible to just search for the prefix of the key (i.e. the txid) instead of the entire key?
Things look fine. Thanks!