Bitcoin Forum
June 22, 2024, 10:03:50 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: higher difficulty acceptance from the node  (Read 682 times)
Mota (OP)
Legendary
*
Offline Offline

Activity: 804
Merit: 1002


View Profile
June 02, 2013, 11:36:06 AM
 #1

I searched around and found nothing in the forum, so here it is:

If one artificially raises the difficulty of the block and finds a valid hash for the higher difficulty, would it get accepted by the node?
Also, I can't wrap my head around the lesser difficulty in some mining pools. How are they accepted if they have lesser leading zeroes?
grau
Hero Member
*****
Offline Offline

Activity: 836
Merit: 1021


bits of proof


View Profile WWW
June 02, 2013, 06:25:57 PM
 #2

difficulty is not number of leading zeros, but a threshold number the block hash has to be less.

A block might satisfy a difficulty higher than currently required, and that would be accepted by others. The difficulty for next block does however not raise with that, its just waste of effort (or luck).
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 02, 2013, 07:04:39 PM
 #3

If one artificially raises the difficulty of the block and finds a valid hash for the higher difficulty, would it get accepted by the node?
No.
It's in AcceptBlock function, in main.cpp

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Mota (OP)
Legendary
*
Offline Offline

Activity: 804
Merit: 1002


View Profile
June 03, 2013, 02:10:17 PM
 #4

Were in AcceptBlock? It seems I can't find a check against it.
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 03, 2013, 02:16:44 PM
 #5

Were in AcceptBlock? It seems I can't find a check against it.

It's kind of hard to miss it, but well..

Code:
        // Check proof of work
        if (nBits != GetNextWorkRequired(pindexPrev, this))
            return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Mota (OP)
Legendary
*
Offline Offline

Activity: 804
Merit: 1002


View Profile
June 03, 2013, 02:25:33 PM
 #6

I saw that, but then it seems that I understood it wrong. Proof of work means for me that it checks if the target is smaller than the last hash given. If I have a higher difficulty (and more leading zeroes) then it should be smaller than the last hash, or did I miss something?
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 03, 2013, 02:30:10 PM
 #7

I saw that, but then it seems that I understood it wrong. Proof of work means for me that it checks if the target is smaller than the last hash given. If I have a higher difficulty (and more leading zeroes) then it should be smaller than the last hash, or did I miss something?
Well in such case I think you probably only missed the lesson of C programming, where they were explaining the magic behind != symbol Wink

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Mota (OP)
Legendary
*
Offline Offline

Activity: 804
Merit: 1002


View Profile
June 03, 2013, 02:55:35 PM
 #8

ah. *cough*  I am reading the code from my tv. bad excuse. -.-
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!