issues with getrawtransaction on a node without txindex=1 even with block hash

6 replies 306 views
moon_bullNewbie
Posts: 53 · Reputation: 38
#1Oct 31, 2017, 08:00 AM
Hey guys, I was checking out the bitcoin-core command help and noticed something weird... I gave it a shot, but the outcome was totally different than I thought. I used and I got this error: So, I figured it should give me the data I requested as long as I provided the block hash, even if my full node doesn’t have txindex set to 1. But the error message from Bitcoin Core is saying just the opposite: I need either txindex enabled or a block hash, so what's going on? I’m running the latest version, so why isn’t it working? Is it possible the help page is out of date? Because when I turn on txindex, it works, but that goes against what the docs and the help page for that command are saying. citb0in
5 Reply Quote Share
Posts: 166 · Reputation: 27
#2Oct 31, 2017, 01:32 PM
Does Bitcoin Core have the block whose hash you provide? Can you getblock it?
4 Reply Quote Share
moon_bullNewbie
Posts: 53 · Reputation: 38
#3Nov 2, 2017, 11:37 PM
Hi Achow, cannot tell you for sure cause meanwhile I enabled txindex and afterwards it worked. Maybe you or anyone else can test this on his own full-node, preferably one without txindex enabled to compare apples by apples. I have no clue why I didn't work on my side, that's why I posted this question here. Cheers citb0in
2 Reply Quote Share
Posts: 166 · Reputation: 27
#4Nov 3, 2017, 03:19 AM
There are tests, and those are passing, so it does work. Either you got the wrong block hash, or your node was missing the block, possibly because it pruned it. Do you know if pruning was enabled? You should be able to discover this by looking at your debug.log. Note that txindex=1 doesn't work with pruning, so your node is no longer pruned if it was in the past.
4 Reply Quote Share
moon_bullNewbie
Posts: 53 · Reputation: 38
#5Nov 3, 2017, 06:47 AM
That node is not pruned, it's an archived full-node. However I am still puzzled cause I'm pretty sure the block hash was correct. If you enter an invalid length of a block hash you will get a warning stating that. The user gets an information how many bytes the used block hash had. Nevertheless, since I've updated to txindex it seems to work. Thanks for your kind feedback and assistance, wish you a nice day. citb0in
1 Reply Quote Share
titanx539Member
Posts: 804 · Reputation: 117
#6Nov 3, 2017, 08:56 AM
As requested, I tested this on my full node Bitcoin Core v26.0.0 and it works if I included the blockhash. The test node doesn't have txidex=1 in the config and has pruned blockchain. The errors also work as intended. If I provide a non-existing block hash: Block hash not found (code -5)If I provide the hash of a pruned block: Block not available (code -1)If I provide a TXID from another block: No such transaction found in the provided block. Use gettransaction for wallet transactions. (code -5)
0 Reply Quote Share
moon_bullNewbie
Posts: 53 · Reputation: 38
#7Nov 3, 2017, 03:04 PM
Hello nc50lc, thanks for the time and effort you took to test it. Unfortunately, I cannot reproduce this without unnecessary additional work. Nevertheless, I cannot (yet) make sense of it. If I stumble across it again at a later date (on another full node), I will dig further and try to find out what caused it. As far as I know at the moment, it looks like it only happened to me and therefore the error is probably 50cm behind the screen  The main thing is that everything is fine with Bitcoin Core and everything is working as expected. Thanks again for testing and feedback. citb0in
3 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics