Merge pull request #359 from jl777/dev

Dev
This commit is contained in:
jl777
2017-03-23 20:48:48 +02:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@@ -109,6 +109,11 @@ base_uint<BITS>& base_uint<BITS>::operator/=(const base_uint& b)
template <unsigned int BITS>
int base_uint<BITS>::CompareTo(const base_uint<BITS>& b) const
{
if ( (uint64_t)pn < 0x1000 || (uint64_t)b.pn <= 0x1000 )
{
fprintf(stderr,"CompareTo null %p or %p\n",pn,b.pn);
return(0);
}
for (int i = WIDTH - 1; i >= 0; i--) {
if (pn[i] < b.pn[i])
return -1;

View File

@@ -367,7 +367,8 @@ void ProcessBlockAvailability(NodeId nodeid) {
if (!state->hashLastUnknownBlock.IsNull()) {
BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock);
if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) {
if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0)
{
if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
state->pindexBestKnownBlock = itOld->second;
state->hashLastUnknownBlock.SetNull();
@@ -387,7 +388,8 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
// An actually better block was announced.
if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
state->pindexBestKnownBlock = it->second;
} else {
} else
{
// An unknown block was announced; just assume that the latest one is the best one.
state->hashLastUnknownBlock = hash;
}