diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 6f4fcb0c1..4c7af34c6 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -898,41 +898,36 @@ void iguana_unspents_mark(struct supernet_info *myinfo,struct iguana_info *coin, void iguana_unspents_markinit(struct supernet_info *myinfo,struct iguana_info *coin) { - static int32_t didinit; char *filestr,fname[1024]; long filesize; bits256 filetxid; cJSON *array,*item; int32_t i,filevout,n,firstslot; - if ( didinit == 0 ) + sprintf(fname,"%s/%s/utxo.json",GLOBAL_DBDIR,coin->symbol), OS_compatible_path(fname); + if ( (filestr= OS_filestr(&filesize,fname)) != 0 ) { - sprintf(fname,"%s/%s/utxo.json",GLOBAL_DBDIR,coin->symbol), OS_compatible_path(fname); - if ( (filestr= OS_filestr(&filesize,fname)) != 0 ) + if ( (array= cJSON_Parse(filestr)) != 0 ) { - if ( (array= cJSON_Parse(filestr)) != 0 ) + printf("iguana_unspents_markinit.(%s)\n",fname); + if ( is_cJSON_Array(array) != 0 && (n= cJSON_GetArraySize(array)) > 0 ) { - printf("iguana_unspents_markinit.(%s)\n",fname); - if ( is_cJSON_Array(array) != 0 && (n= cJSON_GetArraySize(array)) > 0 ) + for (i=0; i= 0 ) { - if ( firstslot >= 0 ) - { - char str[65]; printf("slot.[%d] <- %s/v%d\n",firstslot,bits256_str(str,filetxid),filevout); - coin->markedunspents[firstslot] = filetxid; - coin->markedunspents[firstslot].ushorts[15] = filevout; - } + char str[65]; printf("slot.[%d] <- %s/v%d\n",firstslot,bits256_str(str,filetxid),filevout); + coin->markedunspents[firstslot] = filetxid; + coin->markedunspents[firstslot].ushorts[15] = filevout; } } } - free_json(array); - } else printf("parse error.(%s)\n",filestr); - free(filestr); - } else printf("couldnt open.(%s)\n",fname); - didinit = 1; - } + } + free_json(array); + } else printf("parse error.(%s)\n",filestr); + free(filestr); + } else printf("couldnt open.(%s)\n",fname); } int32_t iguana_RTunspent_check(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_outpoint outpt)