Bitcoin Forum
October 01, 2024, 10:31:01 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 [4] 5 6 7 8 9 »  All
  Print  
Author Topic: 'CACHE'Project [VALM-Cache difficulty recalculation algorithm, SpamHash Control]  (Read 8196 times)
Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 14, 2019, 01:34:44 PM
 #61


New version available

CACHE-Project, All features are enabled and available

Version : v_6.1.1.27
Version of git : v_0.7.5.136
Subversion : v_0.7.6.39


Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 14, 2019, 03:05:36 PM
Last edit: May 14, 2019, 03:35:02 PM by Deff
 #62

  The inclusion of many features was tied to the "debug" setting and was not written about this. In this version, this dependency is removed.
Synchronization of blocks is implemented in three modes -

1)
setreload=0
setreconnecting=0
2)
setreload=0
setreconnecting=1
3)
setreload=1
setreconnecting=0

Coinexchange.io installed the latest version of the wallet and synchronized the blockchain from the zero block to check the balance.
brian_nguyen
Legendary
*
Offline Offline

Activity: 1404
Merit: 1001


View Profile
May 16, 2019, 09:31:17 PM
 #63

 The inclusion of many features was tied to the "debug" setting and was not written about this. In this version, this dependency is removed.
Synchronization of blocks is implemented in three modes -

1)
setreload=0
setreconnecting=0
2)
setreload=0
setreconnecting=1
3)
setreload=1
setreconnecting=0

Coinexchange.io installed the latest version of the wallet and synchronized the blockchain from the zero block to check the balance.

Thank you for your dedication to this project Deff. Without you this coin would have died many moons ago. Cheers!
Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 17, 2019, 03:13:54 AM
 #64

 The inclusion of many features was tied to the "debug" setting and was not written about this. In this version, this dependency is removed.
Synchronization of blocks is implemented in three modes -

1)
setreload=0
setreconnecting=0
2)
setreload=0
setreconnecting=1
3)
setreload=1
setreconnecting=0

Coinexchange.io installed the latest version of the wallet and synchronized the blockchain from the zero block to check the balance.

Thank you for your dedication to this project Deff. Without you this coin would have died many moons ago. Cheers!

Thanks for thanks, dear friend!
 Smiley
Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 17, 2019, 05:30:36 AM
 #65


 According to the tests results:
The optimal mode -

setreload=0
setreconnecting=1

Extreme mode -

setreload=1
setreconnecting=0

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 20, 2019, 02:00:49 PM
 #66


New version available

CACHE-Project, SetControlRealTime added

Version : v_6.1.1.28
Version of git : v_0.7.5.138
Subversion : v_0.7.6.40


Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 20, 2019, 03:30:37 PM
Last edit: May 20, 2019, 04:36:12 PM by Deff
 #67


 New settings and what they are for.

 Options - ("setreload" "setreconnecting") - used when synchronizing blocks.

1) default
Synchronization mode with disconnection from peers sending incorrect data.

setreload=0
setreconnecting=1

2)
Use in cases where some members of the network are not interested in the presence of a large number of synchronized nodes and if they interfere with the completion of synchronization.
Synchronization mode with ignoring all transactions with the current(real) time stamp and disconnection from peers who send incorrect data.

setreload=1
setreconnecting=0


 The "setreconnectpresenttime" option is used after synchronization is complete. Reconnects the wallet to another peer in the absence of a new block within the specified time.
The option "timeupreconnectpresenttime" sets the time in seconds.

Used in many cases, for example, to counter the module "TARPIT".

1) default

setreconnectpresenttime=1
timeupreconnectpresenttime=60*20




Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 21, 2019, 03:23:08 AM
Last edit: May 21, 2019, 07:08:23 AM by Deff
 #68

 
 These additions are implemented to eliminate the possibility of repeated use of the same coins. This is exactly what happened on the Cryptopia Exchange. For double spending, coins with a small number of connections and a small network hash rate or POS coins were chosen. Moreover, an attack of 51% is not obligatory, it is enough to tear off the exchange's wallet from its main network. Coins with which this focus was repeated many times and were delist from the Cryptopia.

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 30, 2019, 04:31:54 AM
 #69

 
  Job the filter - log ..

Code:
accepted connection 167.86.103.109:53424
disconnecting node 167.86.103.109:53424
accepted connection 167.86.103.109:53443
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 1
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 1
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 2
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 3
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 4
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 5
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 6
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 7
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 8
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 9
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 10
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 11
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 12
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 13
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 14
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 15
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 16
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 17
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 18
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 19
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 20
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 21
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 22
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 23
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 24
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 25
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 26
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 27
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 28
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 29
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 30
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 31
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 32
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 33
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 34
disconnecting node 167.86.103.109:53443
accepted connection 167.86.103.109:53654
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 35
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 36
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 37
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 38
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 39
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 40
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 41
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 42
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 43
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 44
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 45
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 46
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 47
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 48
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 49
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 50
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 51
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 52
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 53
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 54
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 55
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 56
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 57
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 58
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 59
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 60
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 61
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 62
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 63
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 64
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 65
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 66
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 67
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 68
socket closed
disconnecting node 167.86.103.109:53654
accepted connection 167.86.103.109:53810
disconnecting node 167.86.103.109:53810
accepted connection 167.86.103.109:53814
disconnecting node 167.86.103.109:53814
accepted connection 167.86.103.109:53816
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 69
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 70
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 71
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 72
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 73
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 74
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 75
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 76
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 77
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 78
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 79
  ProcessMessages - !msg.complete(): 167.86.103.109 - error count: 80
  ProcessMessages - spam ip actual: 167.86.103.109
disconnecting node 167.86.103.109:53816
connection from 167.86.103.109:53882 dropped (IsGlobalIpBanned)

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
May 30, 2019, 12:56:12 PM
 #70


  Work function "setreconnectpresenttime" - log.

Code:
trying connection 188.163.45.132:2225 lastseen=331,3hrs
     For a long time without new blocks - queue: 0 loops from: max
disconnecting node 185.220.101.26:35056
     Start block sync

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
June 05, 2019, 02:12:41 PM
Last edit: June 09, 2019, 12:28:24 PM by Deff
 #71

New version available

CACHE-Project, Adding new features and correcting errors in the balance calculation

Version : v_6.1.1.29
Version of git : v_0.7.5.147
Subversion : v_0.7.6.41


Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
June 05, 2019, 02:37:06 PM
 #72


  Fixed balance calculation errors. Added new features for analyzing addresses and wallet accounts.
New features -

"fixerrorgetbalancefunction"
"getaddressbalance"
"getbalancealladdresses"
"getbasebalancealladdresses"
"getreceivedbyalladdresses"
"getsenttobyalladdresses"
"getstakebalancealladdresses"

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
June 09, 2019, 01:04:42 PM
 #73


New version available

CACHE-Project, Changing the parameters of the "setcontrolrealtime" function. Implemented stop the transfer of a chain of blocks in case of a socket error

Version : v_6.1.1.30
Version of git : v_0.7.5.149
Subversion : v_0.7.6.42


Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
June 09, 2019, 01:25:15 PM
Last edit: June 09, 2019, 02:20:58 PM by Deff
 #74

  
  To enable the function "setcontrolrealtime", you must specify the parameter "setcontrolrealtime=1".
This function changes the limit on the number of transmitted blocks. In the case when the sent "inv"
has one size, and the received "getdata" the other limit is set to 10. Additionally, when transferring
blocks with a height of more than 150000, the limit is set to 30.
  Starting from the previous version, in the event of a socket error, the transfer of a chain of blocks is
interrupted on the block with an error.

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
October 29, 2019, 09:38:14 AM
 #75


  Upcoming changes ...

1) Adaptation of difficulty for NF19 - 20 / min = 0.00024 -> 0.00000096 /

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
October 30, 2019, 04:09:12 PM
 #76

 Upcoming changes ...

2) If the "ChainTrust" matches, the network will not wait for the child block from the competitor’s node. Code..

Code:
// New best
    if (pindexNew->bnChainTrust > bnBestChainTrust)
    {
        if (!SetBestChain(state, txdb, pindexNew))
            return false;
    }
    else if (pindexNew->bnChainTrust == bnBestChainTrust && fHardForkOne && pindexPrevPos->GetBlockHash() >=
        pindexPrevPrevPos->GetBlockHash())
    {
        printf(" 'CBlock' - BestChainTrust %s\n", bnBestChainTrust.ToString().c_str());
        printf(" 'CBlock' - NewChainTrust %s\n", pindexNew->bnChainTrust.ToString().c_str());
        if (((pindexNew->IsProofOfStake() && pindexBest->IsProofOfStake()) ? (pindexNew->GetBlockHash() >
            pindexBest->GetBlockHash()) : (hash > pindexBest->GetBlockHash())) ||
            (pindexBest->IsProofOfWork() && pindexNew->IsProofOfStake()))
        {
            printf(" 'CBlock' bnChainTrust = bnBestChainTrust - Block accepted\n");
            if (!SetBestChain(state, txdb, pindexNew))
            {
                return false;
            }
        }
        else
        {
             printf(" 'CBlock' bnChainTrust = bnBestChainTrust - Block not accepted\n");
             return false;
        }
    }
    else if (pindexNew->bnChainTrust == bnBestChainTrust && fHardForkOne && pindexPrevPos->GetBlockHash() <
             pindexPrevPrevPos->GetBlockHash())
    {
        printf(" 'CBlock_' - BestChainTrust %s\n", bnBestChainTrust.ToString().c_str());
        printf(" 'CBlock_' - NewChainTrust %s\n", pindexNew->bnChainTrust.ToString().c_str());
        if (((pindexNew->IsProofOfStake() && pindexBest->IsProofOfStake()) ? (pindexNew->GetBlockHash() <
            pindexBest->GetBlockHash()) : (hash < pindexBest->GetBlockHash())) ||
            (pindexBest->IsProofOfWork() && pindexNew->IsProofOfStake()))
        {
            printf(" 'CBlock' bnChainTrust = bnBestChainTrust - Block accepted\n");
            if (!SetBestChain(state, txdb, pindexNew))
            {
                return false;
            }
        }
        else
        {
             printf(" 'CBlock' bnChainTrust = bnBestChainTrust - Block not accepted\n");
             return false;
        }
    }
    txdb.Close();


Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
November 04, 2019, 07:08:41 AM
 #77

 
 Upcoming changes ...

Often there are situations in which a chain of blocks with a later timestamp but with greater trust replaces the earlier found blocks.
I do not like such situations, and I consider this vulnerability. In the updated code, a chain of blocks with a larger time stamp loses its trust.
Code ...
Code:
CBlockIndex* pblockindex = NULL;
    int nPossibleHeight = pindexNew->pprev->nHeight + 1;
    if (fDebug)
        printf(" 'AddToBlockIndex()' - The new block pretends to a height %d, block chain height %d\n", nPossibleHeight,
               pindexBest->nHeight);

    if (nPossibleHeight < pindexBest->nHeight && fHardForkOne)
    {
        if (nPossibleHeight <= pindexBest->nHeight - nTriggerDepth)
        {
            if (fDebug)
                printf(" 'AddToBlockIndex()' - The new block pretends to a height %d, maximum allowed block height for a competing chain %d\n", nPossibleHeight,
                pindexBest->nHeight - nTriggerDepth);
            pindexNew->bnChainTrust = 0;

        }

        pblockindex = FindBlockByHeight(nPossibleHeight);
        if (pindexNew->GetBlockTime() > pblockindex->GetBlockTime())
        {
            if (fDebug)
                printf(" 'AddToBlockIndex()' - Generation time of a new block date=%s later than available in the database date=%s\n",
                DateTimeStrFormat("%x %H:%M:%S", pindexNew->GetBlockTime()).c_str(), DateTimeStrFormat("%x %H:%M:%S",
                pblockindex->GetBlockTime()).c_str());
            pindexNew->bnChainTrust = 0;
        }
        else if (pindexNew->GetBlockTime() < pblockindex->GetBlockTime())
        {
                 if (nPossibleHeight < pindexBest->nHeight && nPossibleHeight > pindexBest->nHeight - nTriggerDepth)
                 {
                     if (fDebug)
                         printf(" 'AddToBlockIndex()' - The generation time of a new block date=%s earlier than the one in the database date=%s\n",
                         DateTimeStrFormat("%x %H:%M:%S", pindexNew->GetBlockTime()).c_str(), DateTimeStrFormat("%x %H:%M:%S",
                         pblockindex->GetBlockTime()).c_str());
                     bnBestChainTrust = pblockindex->pprev->bnChainTrust;
                 }
        }
    }

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
November 07, 2019, 06:14:58 AM
 #78

 
  Implemented a new principle of consensus in a dispute between blocks for placement in the main chain. Confidence comparison is used only when the time stamps of competitor blocks are exactly the same. In other cases, the check for the formation of a fork and for the presence of disputed blocks is carried out constantly with the advent of each new block in the network. The check is carried out at the specified depth and can be changed in the settings. When disputed blocks are found, information about the parent block is entered into the log file, and the hash and timestamps are logged for posterity. The block with the earlier timestamp wins. As far as I know, this method has not been used yet, but maybe I'm wrong. It is possible in the  this mode the use of check points will not be appropriate.

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
November 07, 2019, 06:27:30 AM
 #79


  Log of work ...

Code:
received block 1652a05972b98e678461
CheckStakeKernelHash() : using modifier 0x35d696e7b209ef80 at height=349401 timestamp=2019-08-28 19:25:00 UTC for block from height=348699 timestamp=2019-08-19 21:11:31 UTC
CheckStakeKernelHash() : check protocol=0.3 modifier=0x35d696e7b209ef80 nTimeBlockFrom=1566249091 nTxPrevOffset=158 nTimeTxPrev=1566249091 nPrevout=1 nTimeTx=1572903179 hashProof=000001c1e2aca427813ef37c1bc66380e10d2afa0ba691c41d6947d2a4637ced
ComputeNextStakeModifier: prev modifier=0x3c2eb5bf4d3202fd time=2019-11-04 18:08:03 UTC
 'AddToBlockIndex()' - The new block pretends to a height 357245, block chain height 357285
 'AddToBlockIndex()' - A fork is formed, the height of the parent block 357233, hash child blocks hash(1)=46cba156 hash(2)=000084f2, creation date block(1)=04.11.2019 20:04:19 block(2)=04.11.2019 19:19:17,
  priority has a second block, NewChainTrust=0 down
 'AddToBlockIndex()' - Generation time of a new block date=04.11.2019 21:32:59 later than available in the database date=04.11.2019 20:19:24
ProcessBlock: ACCEPTED POS BLOCK
2019-11-06 19:34:49 UTC received: getblocks (997 bytes)

Code:
received block 0001b495e8c947f2aa67
ComputeNextStakeModifier: prev modifier=0x1673d3f6dc47f14c time=2019-11-07 00:10:33 UTC
 'AddToBlockIndex()' - The new block pretends to a height 357365, block chain height 357366
 'AddToBlockIndex()' - A fork is formed, the height of the parent block 357364, hash child blocks hash(1)=0001b495 hash(2)=045a8855, creation date block(1)=11/07/19 03:58:09 block(2)=11/07/19 03:59:48,
  priority has the first block, BestChainTrust=769420279357256 down
 'AddToBlockIndex()' - The generation time of a new block date=11/07/19 03:58:09 earlier than the one in the database date=11/07/19 03:59:48
REORGANIZE
REORGANIZE: Disconnect 2 blocks; 0d7c1fab0c6ac8e5150a..5729d05204aef49d6c0c
REORGANIZE: Connect 1 blocks; 0d7c1fab0c6ac8e5150a..0001b495e8c947f2aa67
     Delete redundant memory transactions that are in the connected branch
REORGANIZE: done
SetBestChain: new best=0001b495e8c947f2aa67  height=357365  trust=769420279357257  date=11/07/19 03:58:09
ProcessBlock: ACCEPTED POW BLOCK
2019-11-07 04:08:04 UTC received: block (335 bytes)

Code:
received block 0001b6228706fd79e42d
Flushed 123 addresses to peers.dat  31ms
ComputeNextStakeModifier: prev modifier=0x1673d3f6dc47f14c time=2019-11-07 00:10:33 UTC
 'AddToBlockIndex()' - The new block pretends to a height 357349, block chain height 357349
 'AddToBlockIndex()' - A fork is formed, the height of the parent block 357348, hash child blocks hash(1)=0001b622 hash(2)=5416c057, creation date block(1)=11/07/19 02:16:20 block(2)=11/07/19 02:19:22,
  priority has the first block, BestChainTrust=769144828228136 down
REORGANIZE
REORGANIZE: Disconnect 1 blocks; 741dae93a19fd2a2df2d..5416c057bc5860a31b1c
REORGANIZE: Connect 1 blocks; 741dae93a19fd2a2df2d..0001b6228706fd79e42d
     Delete redundant memory transactions that are in the connected branch
REORGANIZE: done
SetBestChain: new best=0001b6228706fd79e42d  height=357349  trust=769144828228137  date=11/07/19 02:16:20
ProcessBlock: ACCEPTED POW BLOCK

Deff (OP)
Sr. Member
****
Offline Offline

Activity: 939
Merit: 261

Data HDD Repair - Recovery of lost information


View Profile
November 07, 2019, 06:48:36 AM
 #80

  Code being tested for today ..

Code:
    CBlockIndex* pblockindex = NULL;
    int nPossibleHeight = pindexNew->pprev->nHeight + 1;
    if (fDebug)
        printf(" 'AddToBlockIndex()' - The new block pretends to a height %d, block chain height %d\n", nPossibleHeight,
               pindexBest->nHeight);

    nMaxDepthReplacement = GetArg("-maxdepthreplacement", 50);

    int nFixPrev = 0;
    CBlockIndex* newblockindex = pindexNew;
    int nFixPindexBestnHeight = pindexBest->nHeight;
    if (fHardForkOne)
    {
        if (pindexBest->nHeight > nPossibleHeight)
            nFixPindexBestnHeight = nPossibleHeight;
        if (nPossibleHeight > pindexBest->nHeight)
        {
            nFixPrev = nPossibleHeight - pindexBest->nHeight;
            for (int i = nFixPrev; i > 0; i--)
            {
                 if (i == i)
                 {
                     newblockindex =  newblockindex->pprev;
                 }
            }
        }

        for (int k = nFixPindexBestnHeight; k > nFixPindexBestnHeight - nMaxDepthReplacement; k--)
        {
             CBlockIndex* bestblockindex = FindBlockByHeight(k);
             if (k == k)
             {
                 if (newblockindex->pprev->GetBlockHash() == bestblockindex->pprev->GetBlockHash())
                 {
                     if (nPossibleHeight <= pindexBest->nHeight - nMaxDepthReplacement)
                     {
                         pindexNew->bnChainTrust = 0;
                         if (fDebug)
                             printf(" 'AddToBlockIndex()' - The new block pretends to a height %d, maximum allowed block height for a competing chain %d\n", nPossibleHeight,
                             pindexBest->nHeight - nMaxDepthReplacement);
                         break;
                     }
                     else if (newblockindex->GetBlockTime() > bestblockindex->GetBlockTime())
                     {
                              pindexNew->bnChainTrust = 0;
                              if (fDebug)
                                  printf(" 'AddToBlockIndex()' - A fork is formed, the height of the parent block %d, hash child blocks hash(1)=%s hash(2)=%s, creation date block(1)=%s block(2)=%s,\n",
                                  bestblockindex->pprev->nHeight, newblockindex->GetBlockHash().ToString().substr(0,8).c_str(), bestblockindex->GetBlockHash().
                                  ToString().substr(0,8).c_str(), DateTimeStrFormat("%x %H:%M:%S", newblockindex->GetBlockTime()).c_str(), DateTimeStrFormat("%x %H:%M:%S",
                                  bestblockindex->GetBlockTime()).c_str());
                                  printf("  priority has a second block, NewChainTrust=%s down\n", pindexNew->bnChainTrust.ToString().c_str());
                              break;
                     }
                     else if (newblockindex->GetBlockTime() < bestblockindex->GetBlockTime() &&
                              nPossibleHeight > pindexBest->nHeight - nMaxDepthReplacement)
                     {
                              bnBestChainTrust = bestblockindex->pprev->bnChainTrust;;
                              if (fDebug)
                                  printf(" 'AddToBlockIndex()' - A fork is formed, the height of the parent block %d, hash child blocks hash(1)=%s hash(2)=%s, creation date block(1)=%s block(2)=%s,\n",
                                  bestblockindex->pprev->nHeight, newblockindex->GetBlockHash().ToString().substr(0,8).c_str(), bestblockindex->GetBlockHash().
                                  ToString().substr(0,8).c_str(), DateTimeStrFormat("%x %H:%M:%S", newblockindex->GetBlockTime()).c_str(), DateTimeStrFormat("%x %H:%M:%S",
                                  bestblockindex->GetBlockTime()).c_str());
                                  printf("  priority has the first block, BestChainTrust=%s down\n", bnBestChainTrust.ToString().c_str());
                              break;
                     }
                 }
                 newblockindex =  newblockindex->pprev;
             }
        }
    }

    if (nPossibleHeight < pindexBest->nHeight && fHardForkOne)
    {
        pblockindex = FindBlockByHeight(nPossibleHeight);
        if (pindexNew->GetBlockTime() > pblockindex->GetBlockTime())
        {
            if (fDebug)
                printf(" 'AddToBlockIndex()' - Generation time of a new block date=%s later than available in the database date=%s\n",
                DateTimeStrFormat("%x %H:%M:%S", pindexNew->GetBlockTime()).c_str(), DateTimeStrFormat("%x %H:%M:%S",
                pblockindex->GetBlockTime()).c_str());
            pindexNew->bnChainTrust = 0;
        }
        else if (pindexNew->GetBlockTime() < pblockindex->GetBlockTime())
        {
                 if (nPossibleHeight < pindexBest->nHeight && nPossibleHeight > pindexBest->nHeight - nMaxDepthReplacement)
                 {
                     if (fDebug)
                         printf(" 'AddToBlockIndex()' - The generation time of a new block date=%s earlier than the one in the database date=%s\n",
                         DateTimeStrFormat("%x %H:%M:%S", pindexNew->GetBlockTime()).c_str(), DateTimeStrFormat("%x %H:%M:%S",
                         pblockindex->GetBlockTime()).c_str());
                     bnBestChainTrust = pblockindex->pprev->bnChainTrust;
                 }
        }
    }

    // New best
    if (pindexNew->bnChainTrust > bnBestChainTrust)
    {
        if (!SetBestChain(state, txdb, pindexNew))
            return false;
    }
    else if (pindexNew->bnChainTrust == bnBestChainTrust && fHardForkOne && pindexPrevPos->GetBlockHash() >=
             pindexPrevPrevPos->GetBlockHash())
    {
             printf(" 'AddToBlockIndex()' - BestChainTrust %s\n", bnBestChainTrust.ToString().c_str());
             printf(" 'AddToBlockIndex()' - NewChainTrust %s\n", pindexNew->bnChainTrust.ToString().c_str());
             if (((pindexNew->IsProofOfStake() && pindexBest->IsProofOfStake()) ? (pindexNew->GetBlockHash() >
                 pindexBest->GetBlockHash()) : (hash > pindexBest->GetBlockHash())) ||
                 (pindexBest->IsProofOfWork() && pindexNew->IsProofOfStake()))
             {
                 printf(" 'AddToBlockIndex()' bnChainTrust = bnBestChainTrust - Block accepted\n");
                 if (!SetBestChain(state, txdb, pindexNew))
                 {
                     return false;
                 }
             }
             else
             {
                  printf(" 'AddToBlockIndex()' bnChainTrust = bnBestChainTrust - Block not accepted\n");
             }
    }
    else if (pindexNew->bnChainTrust == bnBestChainTrust && fHardForkOne && pindexPrevPos->GetBlockHash() <
             pindexPrevPrevPos->GetBlockHash())
    {
             printf(" 'AddToBlockIndex()_' - BestChainTrust %s\n", bnBestChainTrust.ToString().c_str());
             printf(" 'AddToBlockIndex()_' - NewChainTrust %s\n", pindexNew->bnChainTrust.ToString().c_str());
             if (((pindexNew->IsProofOfStake() && pindexBest->IsProofOfStake()) ? (pindexNew->GetBlockHash() <
                 pindexBest->GetBlockHash()) : (hash < pindexBest->GetBlockHash())) ||
                 (pindexBest->IsProofOfWork() && pindexNew->IsProofOfStake()))
             {
                 printf(" 'AddToBlockIndex()_' bnChainTrust = bnBestChainTrust - Block accepted\n");
                 if (!SetBestChain(state, txdb, pindexNew))
                 {
                     return false;
                 }
             }
             else
             {
                  printf(" 'AddToBlockIndex()_' bnChainTrust = bnBestChainTrust - Block not accepted\n");
             }
    }

Pages: « 1 2 3 [4] 5 6 7 8 9 »  All
  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!