@@ -109,6 +109,11 @@ base_uint<BITS>& base_uint<BITS>::operator/=(const base_uint& b)
|
|||||||
template <unsigned int BITS>
|
template <unsigned int BITS>
|
||||||
int base_uint<BITS>::CompareTo(const base_uint<BITS>& b) const
|
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--) {
|
for (int i = WIDTH - 1; i >= 0; i--) {
|
||||||
if (pn[i] < b.pn[i])
|
if (pn[i] < b.pn[i])
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -367,7 +367,8 @@ void ProcessBlockAvailability(NodeId nodeid) {
|
|||||||
|
|
||||||
if (!state->hashLastUnknownBlock.IsNull()) {
|
if (!state->hashLastUnknownBlock.IsNull()) {
|
||||||
BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock);
|
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)
|
if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
|
||||||
state->pindexBestKnownBlock = itOld->second;
|
state->pindexBestKnownBlock = itOld->second;
|
||||||
state->hashLastUnknownBlock.SetNull();
|
state->hashLastUnknownBlock.SetNull();
|
||||||
@@ -387,7 +388,8 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
|
|||||||
// An actually better block was announced.
|
// An actually better block was announced.
|
||||||
if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
|
if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
|
||||||
state->pindexBestKnownBlock = it->second;
|
state->pindexBestKnownBlock = it->second;
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
// An unknown block was announced; just assume that the latest one is the best one.
|
// An unknown block was announced; just assume that the latest one is the best one.
|
||||||
state->hashLastUnknownBlock = hash;
|
state->hashLastUnknownBlock = hash;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user