Author

Topic: Any way to disable/delay pruning or get pruned trx in bitcoind? (Read 681 times)

hero member
Activity: 784
Merit: 1009
firstbits:1MinerQ
I'm guessing it needs to re-download the blockchain otherwise any trx with old inputs will still be incomplete.
No, it just needs to go build the index. You have all the data.
Ok. Good to know.

Quote
I've been keeping the mempool data cached so I can determine when a trx is first seen. Summing inputs and outputs when I put it in the cache is going to work ok. Just took me a few minutes to think of doing it that way. It's running now and I'm just waiting for a new block to make sure it works ok.
This will fail sometimes because sometimes the first time you see a transaction is in a block. That transaction may be spent by another transaction in the same block
Hmm. Can that happen? Wouldn't it also be in the mempool even if it depends on a transaction within the same block? I can probably live with it even if it does since I'm just tallying "blocks until confirmed" but I'm curious how that happens.
staff
Activity: 4284
Merit: 8808
I'm guessing it needs to re-download the blockchain otherwise any trx with old inputs will still be incomplete.
No, it just needs to go build the index. You have all the data.

Quote
I've been keeping the mempool data cached so I can determine when a trx is first seen. Summing inputs and outputs when I put it in the cache is going to work ok. Just took me a few minutes to think of doing it that way. It's running now and I'm just waiting for a new block to make sure it works ok.
This will fail sometimes because sometimes the first time you see a transaction is in a block. That transaction may be spent by another transaction in the same block
hero member
Activity: 784
Merit: 1009
firstbits:1MinerQ
The txindex command-line or config file option should do this for you.
Ah good. I see that now. Probably won't need to use it.
hero member
Activity: 784
Merit: 1009
firstbits:1MinerQ
there is a simpler way.  I can't remember it off the top of my head but there is a config flag which turns off pruning.
Thanks.
I'm guessing it needs to re-download the blockchain otherwise any trx with old inputs will still be incomplete.

I've been keeping the mempool data cached so I can determine when a trx is first seen. Summing inputs and outputs when I put it in the cache is going to work ok. Just took me a few minutes to think of doing it that way. It's running now and I'm just waiting for a new block to make sure it works ok.

So what I do is poll bitcoind and any new mempool trx I grab and sum values and add to my cache. Then when a new block is detected I scan it for the cached trx. If it's in there then I add the diff between block it was cached and this block into my stats counters based on trx amount/fee and remove the trx from my cache. I think this works ok.

The only real messy bit now is deciding what the trx amount really is. I'm using the outputs summed for now but I know it's not correct. I can't read the mind of the sender.
legendary
Activity: 1204
Merit: 1015
The txindex command-line or config file option should do this for you.
donator
Activity: 1218
Merit: 1079
Gerald Davis
there is a simpler way.  I can't remember it off the top of my head but there is a config flag which turns off pruning.
hero member
Activity: 784
Merit: 1009
firstbits:1MinerQ
Ok. I think I've figured out how to work around this.

I can sum the inputs from the pending trx in the mempool and store it. That way when the trx is confirmed and the outputs get pruned I already have the value I need.

I'm testing this now.
hero member
Activity: 784
Merit: 1009
firstbits:1MinerQ
I'm working on a script to provides stats on confirmation speed for various trx amount/fee ranges.

I've got most of it working but when I try to sum trx inputs to calculate the fee I find that usually the inputs trx are already missing. I presume they've been pruned quickly as the block was processed.

The output should still be there if it's just been used as input in a new trx. But since I rely on the API the block gets processed before I can grab the inputs I need. Maybe I need to grab the inputs before the block arrives?

How do I make bitcoind stop pruning? Do I need to set a compile option and rebuild and will it need to fully sync the blockchain again?

Or is there some way I can query the network asking for pruned trx I need?



Jump to: