Why does getdata have a field for the number of inventory entries?

0

After a node receives an inv message, you can get the data for each tx/block hash using getdata:

getdata - Request a single block or transaction by hash.

So if you can only get one tx or block at a time, what's the purpose of having a field in the getdata message for the number of entries you are requesting?

Field Size  Description   Data type   Comments
----------  ------------  ----------  -------------
?           count         var_int     Number of inventory entries
36x?        inventory     inv_vect[]  Inventory vectors

https://wiki.bitcoin.com/w/Network#Messages https://en.bitcoin.it/wiki/Protocol_documentation#getdata

inersha

Posted 2016-09-05T14:37:22.077

Reputation: 2 236

Answers

1

The documentation you are linking too is wrong, the bitcoin developer reference indicates you can send multiple inventories inside of a GetData message.

Chris Stewart

Posted 2016-09-05T14:37:22.077

Reputation: 865

It's not wrong, but maybe not very client. The [] after inv_vect indicates it's about an array of entries.Pieter Wuille 2016-09-05T15:51:51.863

Not sure what you mean by 'very client' you mean varies by client version?Chris Stewart 2016-09-05T18:45:29.080

Sorry, "very clear" !Pieter Wuille 2016-09-05T18:57:39.650

Sorry, I was talking about the protocol spec copy-paste. The statement "Request a single block or transaction by hash" is clearly wrong.Pieter Wuille 2016-11-04T17:21:42.207