Bitcoin Forum
November 04, 2024, 09:33:24 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Getting block headers  (Read 716 times)
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 20, 2013, 09:55:35 AM
Last edit: April 20, 2013, 11:35:11 AM by jackjack
 #1

Hi
I ran into something strange when I'm downloading block hashes from bitcoin nodes (let's call my script 'BD')
When I'm connecting to 63.247.147.163 (all fallback nodes on the wiki* behave the same way), the following happens:
  • BD sends version
  • BD receives version and verack
  • BD sends verack
  • BD regularly receives tx inv's (about 1 per second)
Moreover, sending getblocks doesn't change anything and I still receive only tx inv's

On the other hand, when I connect to my local bitcoin node (127.0.0.1 ofc), that becomes:
  • BD sends version
  • BD receives version and verack
  • BD sends verack
  • BD receives tons of block hash inv's (yeah, TONS OF THEM)
I didn't even try to send a getblocks...


So, why does my local node behaves differently than the other ones?



(*) all the nodes I tested on http://blockchain.info/connected-nodes too



Edit: 98.26.149.98:8333 sends me some block headers after a getblocks

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
Zeilap
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
April 20, 2013, 10:52:49 AM
 #2

Is your local node syncing at the time?

There is a new field in the version message you send which tells the other peer not to send you inv's like this.

To receive block headers, you need to ask with a 'getheaders' message, it doesn't follow the 'getblocks' -> receive 'inv' -> 'getdata' -> receive block  message sequence.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 20, 2013, 10:57:24 AM
Last edit: April 20, 2013, 11:13:46 AM by jackjack
 #3

Absolutely
Does this change anything? I didn't saw anything about it
I didn't finish reading https://en.bitcoin.it/wiki/Satoshi_Client_Block_Exchange though


Edit:
I just checked what the two responding nodes (localhost and 98.26...) and it looks like they are sending me their last blocks
localhost is sending me hashes of blocks number ~134k

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
Zeilap
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
April 20, 2013, 11:27:43 AM
 #4

The client will relay invs to its other peers for every new block it receives. If it's syncing, then it receives a lot of new blocks and so you get a lot of invs.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 20, 2013, 11:34:53 AM
 #5

Thanks!


I didn't see your edit
There is a new field in the version message you send which tells the other peer not to send you inv's like this.
Thanks a lot, that'll clean my display

To receive block headers, you need to ask with a 'getheaders' message, it doesn't follow the 'getblocks' -> receive 'inv' -> 'getdata' -> receive block  message sequence.
Yeah, I was mixing getheaders and getblocks

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
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!