Bitcoin Forum
November 10, 2024, 03:51:49 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Are historical blocks validated on current rules?  (Read 239 times)
FlatPepsi (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 1


View Profile
July 16, 2018, 04:12:02 PM
 #1

Let's say I start up a new full node, with nothing but the code & the embedded Genesis block.  My node then asks nearby nodes for blocks to build up my chain.

As I start getting blocks 1, 2, and 3 from 2009, is each block validated using today's current rules?

I'm thinking that there has to have been ancient blocks in the chain that, at the time were valid, but new security rules have since made them invalid.
For example, does famous block 501726 still cause problems?

Kallisteiros
Copper Member
Member
**
Offline Offline

Activity: 85
Merit: 122


View Profile
July 16, 2018, 08:52:08 PM
Merited by suchmoon (5), ABCbits (1)
 #2

Yes, the full node doesn't just blindly trust other nodes with whatever blocks they send your way, but actually validates every block and all transactions in it starting from genesis. If a block turns out to be invalid, it is discarded, and the peer giving you such invalid blocks may be banned.

When consensus rules are updated, and a new version is out, the new rules are usually applied starting from specific future point. Within the code, there is a switch saying: if the block height is less than this, validate it using old rules, otherwise with the new ones. Also keep in mind that this creates a hard fork, causing the nodes with the old and new software ban each other and have two different chains.
Kallisteiros
Copper Member
Member
**
Offline Offline

Activity: 85
Merit: 122


View Profile
July 16, 2018, 09:01:01 PM
 #3

With that being said, block 501726 was always valid under all consensus rules, even though it was a weird block. Some software might have choked on it, but the network continued to build on top of it.
aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
July 17, 2018, 01:30:32 PM
 #4

By default Bitcoin Core assumes blocks that came before a block with certain hard-coded hex value are valid.
In the latest version, all blocks before block no. 506067 are assumed valid unless specified otherwise with an -assumevalid argument.
Kallisteiros
Copper Member
Member
**
Offline Offline

Activity: 85
Merit: 122


View Profile
July 17, 2018, 02:28:54 PM
 #5

Ah right, forgot about that update. There are also checkpoints, which force selection of a particular chain (go up to block 295000), but IIRC the validation was still performed, unlike with assumevalid (that allows to skip validation but does not the node to accept the chain if a valid longer one with more work is presented).
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
July 18, 2018, 05:50:33 PM
Merited by theymos (10), Foxpup (3), ABCbits (2)
 #6

By default Bitcoin Core assumes blocks that came before a block with certain hard-coded hex value are valid.
In the latest version, all blocks before block no. 506067 are assumed valid unless specified otherwise with an -assumevalid argument.
No, that is not true. The scripts are assumed to be valid, but the blocks themselves are not. They are still checked for everything else, just the transaction scripts are not verified.

aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
July 19, 2018, 10:26:22 AM
 #7

By default Bitcoin Core assumes blocks that came before a block with certain hard-coded hex value are valid.
In the latest version, all blocks before block no. 506067 are assumed valid unless specified otherwise with an -assumevalid argument.
No, that is not true. The scripts are assumed to be valid, but the blocks themselves are not. They are still checked for everything else, just the transaction scripts are not verified.

Thanks for clarification Smiley It makes sense
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!