Title: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: BkkCoins on April 11, 2013, 02:48:25 AM 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? Title: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: BkkCoins on April 11, 2013, 03:06:55 AM 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. Title: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: DeathAndTaxes on April 11, 2013, 03:07:39 AM 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.
Title: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: Maged on April 11, 2013, 03:22:52 AM The txindex command-line or config file option should do this for you.
Title: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: BkkCoins on April 11, 2013, 03:26:39 AM 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. Title: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: BkkCoins on April 11, 2013, 03:29:39 AM 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.Title: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: gmaxwell on April 11, 2013, 03:37:31 AM 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 blockTitle: Re: Any way to disable/delay pruning or get pruned trx in bitcoind? Post by: BkkCoins on April 11, 2013, 03:43:46 AM 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 |