Bitcoin Forum
May 07, 2024, 04:45:45 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Any way to disable/delay pruning or get pruned trx in bitcoind?  (Read 665 times)
BkkCoins (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 11, 2013, 02:48:25 AM
 #1

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?




1715057145
Hero Member
*
Offline Offline

Posts: 1715057145

View Profile Personal Message (Offline)

Ignore
1715057145
Reply with quote  #2

1715057145
Report to moderator
Remember that Bitcoin is still beta software. Don't put all of your money into BTC!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715057145
Hero Member
*
Offline Offline

Posts: 1715057145

View Profile Personal Message (Offline)

Ignore
1715057145
Reply with quote  #2

1715057145
Report to moderator
BkkCoins (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 11, 2013, 03:06:55 AM
 #2

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.

DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
April 11, 2013, 03:07:39 AM
 #3

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.
Maged
Legendary
*
Offline Offline

Activity: 1204
Merit: 1015


View Profile
April 11, 2013, 03:22:52 AM
 #4

The txindex command-line or config file option should do this for you.

BkkCoins (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 11, 2013, 03:26:39 AM
 #5

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.

BkkCoins (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 11, 2013, 03:29:39 AM
 #6

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.

gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
April 11, 2013, 03:37:31 AM
 #7

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
BkkCoins (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 11, 2013, 03:43:46 AM
 #8

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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!