jl777 7 years ago
parent
commit
186c1d5e80
  1. 2
      iguana/dpow/dpow_tx.c
  2. 9
      iguana/iguana_notary.c

2
iguana/dpow/dpow_tx.c

@ -169,6 +169,8 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info
int32_t r,h,incr = 100000; struct dpow_block *bp = 0; int32_t r,h,incr = 100000; struct dpow_block *bp = 0;
if ( height > dp->maxblocks ) if ( height > dp->maxblocks )
{ {
if ( dp->maxblocks+incr < height+10000 )
incr = (height+10000) - dp->maxblocks;
dp->blocks = realloc(dp->blocks,sizeof(*dp->blocks) * (dp->maxblocks + incr)); dp->blocks = realloc(dp->blocks,sizeof(*dp->blocks) * (dp->maxblocks + incr));
memset(&dp->blocks[dp->maxblocks],0,sizeof(*dp->blocks) * incr); memset(&dp->blocks[dp->maxblocks],0,sizeof(*dp->blocks) * incr);
dp->maxblocks += incr; dp->maxblocks += incr;

9
iguana/iguana_notary.c

@ -95,7 +95,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
if ( height > 0 && blocktime > 0 ) if ( height > 0 && blocktime > 0 )
{ {
dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime);
if ( (1) &&strcmp("CHIPS",dp->symbol) == 0 ) if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("dynamic set %s/%s %s <- height.%d\n",dp->symbol,dp->dest,bits256_str(str,hash),height); printf("dynamic set %s/%s %s <- height.%d\n",dp->symbol,dp->dest,bits256_str(str,hash),height);
checkpoint = dp->last; checkpoint = dp->last;
} else return; } else return;
@ -109,7 +109,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized)); printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized));
return; return;
} }
if ( (1) && strcmp("CHIPS",dp->symbol) == 0 ) if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash)); printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash));
} else return; } else return;
} else return; } else return;
@ -118,7 +118,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
} }
if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 ) if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 )
{ {
if ( (1) && strcmp("CHIPS",dp->symbol) == 0 ) if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs);
dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000); dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000);
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint) + sizeof(pthread_t)); ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint) + sizeof(pthread_t));
@ -139,7 +139,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
{ {
if ( strcmp("CHIPS",dp->symbol) == 0 ) if ( strcmp("CHIPS",dp->symbol) == 0 )
printf("ht.%d maxblocks.%d\n",ht,dp->maxblocks); printf("ht.%d maxblocks.%d\n",ht,dp->maxblocks);
for (i=ht-500; i>100; i--) for (i=ht-500; i>ht-10000; i--)
{ {
if ( (i % 100) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) if ( (i % 100) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff )
{ {
@ -148,6 +148,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
free(bp); free(bp);
} }
} }
printf("i.%d\n",i);
} }
} }
} }

Loading…
Cancel
Save