| 84 | } |
| 85 | |
| 86 | bool CPBFTMan::UpdateGlobalFinBlock(const uint32_t height) { |
| 87 | { |
| 88 | LOCK(cs_finblock); |
| 89 | CBlockIndex* oldGlobalFinblock = GetGlobalFinIndex(); |
| 90 | CBlockIndex* localFinblock = GetLocalFinIndex(); |
| 91 | |
| 92 | if(localFinblock== nullptr ||height > (uint32_t)localFinblock->height) |
| 93 | return false; |
| 94 | if(oldGlobalFinblock != nullptr && (uint32_t)oldGlobalFinblock->height >= height) |
| 95 | return false; |
| 96 | |
| 97 | if(oldGlobalFinblock != nullptr ){ |
| 98 | CBlockIndex* chainBlock = chainActive[oldGlobalFinblock->height]; |
| 99 | if(chainBlock != nullptr && chainBlock->GetBlockHash() != oldGlobalFinblock->GetBlockHash()){ |
| 100 | return ERRORMSG("Global finality block changed"); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | CBlockIndex* pTemp = chainActive[height]; |
| 105 | if(pTemp== nullptr) |
| 106 | return false; |
| 107 | globalFinIndex = pTemp; |
| 108 | globalFinHash = pTemp->GetBlockHash(); |
| 109 | pCdMan->pBlockCache->WriteGlobalFinBlock(pTemp->height, pTemp->GetBlockHash()); |
| 110 | return true; |
| 111 | } |
| 112 | |
| 113 | } |
| 114 | |
| 115 | bool CPBFTMan::UpdateLocalFinBlock(const CBlockIndex* pIndex){ |
| 116 |
no test coverage detected