Bitcoin Forum
May 02, 2024, 03:11:28 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Optimize checkblock transaction checking on Bitcoin Core  (Read 1400 times)
namecoin (OP)
Newbie
*
Offline Offline

Activity: 38
Merit: 0


View Profile
September 09, 2015, 07:53:41 AM
 #1

It seems that we might be able to optimize some transaction checkings. 
Many checkings are done twice:
1. when the transaction is placed into the pool
2. when verifying validity of the transaction in a block

Why don't we simply check if the transaction in a block is already in the memory pool?  The transaction is already verified when it is placed into the pool. 

Does this makes sense?  If so, is there a reason that bitcoind does not want to do this?   Huh

Thank you very much for your review.
The network tries to produce one block per 10 minutes. It does this by automatically adjusting how difficult it is to produce blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714619488
Hero Member
*
Offline Offline

Posts: 1714619488

View Profile Personal Message (Offline)

Ignore
1714619488
Reply with quote  #2

1714619488
Report to moderator
1714619488
Hero Member
*
Offline Offline

Posts: 1714619488

View Profile Personal Message (Offline)

Ignore
1714619488
Reply with quote  #2

1714619488
Report to moderator
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
September 09, 2015, 08:18:59 AM
 #2

It seems that we might be able to optimize some transaction checkings. 
Many checkings are done twice:
1. when the transaction is placed into the pool
2. when verifying validity of the transaction in a block
Yes, may be some checks can be skipped (if not already)
But.
1) What do you want to achieve?
2) Can you calculate (in btc or bucks or kwh) the benefits of this refactoring?
3) Can you rewrite code yourself and submit a pull-request?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4613



View Profile
September 09, 2015, 11:30:17 AM
 #3

I think it would be a problem to just check if the transaction is already in the memory pool, wouldn't it?

Isn't it possible for other transactions that are already in the block to make some transactions in the memory pool invalid?
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
September 09, 2015, 11:59:05 AM
 #4

It is possible to skip ECDSA signature verification if it was passed before.
As far as I remember Bitcoin Core Client caches valid signatures (but I do not know the size of this LRU cache).

Anyway, one is able to make any changes in code and add/remove any checks.
Just do it yourself and tell us about the results.
namecoin (OP)
Newbie
*
Offline Offline

Activity: 38
Merit: 0


View Profile
September 10, 2015, 10:25:02 AM
Last edit: September 11, 2015, 06:20:26 AM by namecoin
 #5

It seems that we might be able to optimize some transaction checkings.  
Many checkings are done twice:
1. when the transaction is placed into the pool
2. when verifying validity of the transaction in a block
Yes, may be some checks can be skipped (if not already)
But.
1) What do you want to achieve?
2) Can you calculate (in btc or bucks or kwh) the benefits of this refactoring?
3) Can you rewrite code yourself and submit a pull-request?


Thanks for the inputs, amaclin and DannyHamilton.

1) Increase the tps that a node can process.  It seems that our test machine cannot process more than 15 transactions per seconds (not talking about mining or blocksize).
3) My friend has the change already and can submit a pull-request.  
namecoin (OP)
Newbie
*
Offline Offline

Activity: 38
Merit: 0


View Profile
September 17, 2015, 06:58:32 AM
 #6

FYI. The pull request filed earlier.
https://github.com/bitcoin/bitcoin/pull/6659
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!