Browse Source

Merge branch 'master' into release/v0.1

release/v0.1
jl777 8 years ago
parent
commit
11e8283a18
  1. 4
      crypto777/OS_nonportable.c
  2. 2
      iguana/iguana_bundles.c
  3. 11
      iguana/iguana_ramchain.c
  4. 10
      iguana/iguana_recv.c
  5. 20
      iguana/iguana_unspents.c
  6. 4
      includes/iguana_structs.h

4
crypto777/OS_nonportable.c

@ -47,12 +47,12 @@ void *OS_nonportable_tmpalloc(char *dirname,char *name,struct OS_memspace *mem,l
#include <tlhelp32.h>
#include <time.h>
#include <intrin.h>
/*#include <intrin.h>
static uint32_t __inline __builtin_clzll(uint64_t x) {
unsigned long r = 0;
_BitScanReverse64(&r, x);
return (63-r);
}
}*/
void usleep(int32_t micros)
{

2
iguana/iguana_bundles.c

@ -266,7 +266,7 @@ int32_t iguana_bundlehash2add(struct iguana_info *coin,struct iguana_block **blo
bp->n = bundlesize;//(bundlei < bundlesize-1) ? bundlesize : (bundlei + 1);
if ( (setval= iguana_hash2set(coin,"blockadd",bp,bundlei,hash2)) == 0 )
{
if ( (block->hdrsi != bp->hdrsi || block->bundlei != bundlei) && (block->hdrsi != 0 || block->bundlei != 0) )
if ( block->bundlei >= 0 && ((block->hdrsi != bp->hdrsi || block->bundlei != bundlei) && (block->hdrsi != 0 || block->bundlei != 0)) )
{
char str[65]; printf("blockadd warning: %d[%d] main.%d prevent <- %d[%d] %s\n",block->hdrsi,block->bundlei,block->mainchain,bp->hdrsi,bundlei,bits256_str(str,hash2));
//iguana_blockunmark(coin,block,bp,bundlei,block->mainchain != 0);

11
iguana/iguana_ramchain.c

@ -1024,7 +1024,7 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
printf("ramchainsave no data ptr\n");
return(-1);
}
if ( (checki= iguana_peerfname(coin,&hdrsi,ipbits==0?GLOBAL_DBDIR:GLOBAL_TMPDIR,fname,ipbits,hash2,prevhash2,ramchain->numblocks,1)) != bundlei || bundlei < 0 || bundlei >= coin->chain->bundlesize )
if ( (bundlei >= 0 && (checki= iguana_peerfname(coin,&hdrsi,ipbits==0?GLOBAL_DBDIR:GLOBAL_TMPDIR,fname,ipbits,hash2,prevhash2,ramchain->numblocks,1)) != bundlei) || bundlei >= coin->chain->bundlesize )
{
printf(" wont save.(%s) bundlei.%d != checki.%d\n",fname,bundlei,checki);
return(-1);
@ -1280,14 +1280,15 @@ int32_t iguana_bundleremove(struct iguana_info *coin,int32_t hdrsi,int32_t tmpfi
struct iguana_bundle *bp; int32_t i; char fname[1024],str[65];
if ( hdrsi >= 0 && hdrsi < coin->bundlescount && (bp= coin->bundles[hdrsi]) != 0 )
{
iguana_volatilespurge(coin,&bp->ramchain);
printf("%s delete bundle.[%d]\n",coin->symbol,hdrsi);
if ( iguana_bundlefname(coin,bp,fname) == 0 )
OS_removefile(fname,0);
if ( tmpfiles != 0 )
{
for (i=0; i<bp->n; i++)
iguana_blockunmark(coin,bp->blocks[i],bp,i,1);
}
if ( iguana_bundlefname(coin,bp,fname) == 0 )
OS_removefile(fname,0);
sprintf(fname,"%s/%s/spends/%s.%d",GLOBAL_DBDIR,coin->symbol,bits256_str(str,bp->hashes[0]),bp->bundleheight), OS_removefile(fname,0);
sprintf(fname,"%s/%s/accounts/debits.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight), OS_removefile(fname,0);
sprintf(fname,"%s/%s/accounts/lastspends.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight), OS_removefile(fname,0);
@ -2031,9 +2032,9 @@ void iguana_blockunmark(struct iguana_info *coin,struct iguana_block *block,stru
}
if ( deletefile != 0 && block != 0 )
iguana_blockdelete(coin,block->RO.hash2,i);
if ( coin->RTheight > 0 && height > 0 && height < coin->blocks.hwmchain.height )
if ( 0 && coin->RTheight > 0 && height > 0 && height < coin->blocks.hwmchain.height )
{
printf("reduce HWM height from %d to %d\n",coin->blocks.hwmchain.height,height);
printf("reduce %s HWM height from %d to %d\n",coin->symbol,coin->blocks.hwmchain.height,height);
if ( (block= iguana_blockfind("unmark",coin,iguana_blockhash(coin,height))) != 0 )
iguana_blockcopy(coin->chain->zcash,coin->chain->auxpow,coin,(struct iguana_block *)&coin->blocks.hwmchain,block);
}

10
iguana/iguana_recv.c

@ -810,6 +810,8 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru
//printf("getblockM update [%d:%d] %s\n",bp->hdrsi,bundlei,bits256_str(str,origtxdata->zblock.RO.hash2));
if ( block != 0 )
{
if ( block->height < 0 )
block->bundlei = -1;
block->txvalid = 1;
if ( block->fpipbits != 0 && block->fpos >= 0 )
{
@ -1077,12 +1079,9 @@ int32_t iguana_bundlehashadd(struct iguana_info *coin,struct iguana_bundle *bp,i
}
}
if ( bp->blocks[bundlei] == 0 )
{
firstflag = 1;
bp->blocks[bundlei] = block;
bp->hashes[bundlei] = block->RO.hash2;
}
bp->blocks[bundlei] = block;
//bp->blocks[bundlei] = block;
//bp->hashes[bundlei] = block->RO.hash2;
iguana_bundlehash2add(coin,0,bp,bundlei,block->RO.hash2);
if ( firstflag != 0 && bp->emitfinish == 0 )
{
@ -1127,6 +1126,7 @@ void iguana_bundle_set(struct iguana_info *coin,struct iguana_block *block,int32
{
bp->blocks[bundlei] = block;
bp->hashes[bundlei] = block->RO.hash2;
iguana_bundlehash2add(coin,0,bp,bundlei,block->RO.hash2);
if ( bp->speculative != 0 )
bp->speculative[bundlei] = block->RO.hash2;
//char str[65]; printf("SET %s ht.%d in [%d:%d]\n",bits256_str(str,block->RO.hash2),height,hdrsi,bundlei);

20
iguana/iguana_unspents.c

@ -382,7 +382,11 @@ int32_t iguana_uheight(struct iguana_info *coin,int32_t bundleheight,struct igua
int32_t iguana_outpt_set(struct iguana_info *coin,struct iguana_outpoint *outpt,struct iguana_unspent *u,uint32_t unspentind,int16_t hdrsi,bits256 txid,int32_t vout,uint8_t *rmd160,uint8_t *pubkey33)
{
<<<<<<< HEAD
char scriptstr[IGUANA_MAXSCRIPTSIZE*2+1],asmstr[16384];
=======
char scriptstr[IGUANA_MAXSCRIPTSIZE*2+1],asmstr[16384];
>>>>>>> master
memset(outpt,0,sizeof(*outpt));
outpt->txid = txid;
outpt->vout = vout;
@ -840,10 +844,10 @@ int32_t iguana_RTunspent_check(struct supernet_info *myinfo,struct iguana_info *
//char str[65]; printf("verify %s/v%d is not already used\n",bits256_str(str,txid),vout);
//return(iguana_RTspentflag(myinfo,coin,&RTspend,&spentheight,ramchain,outpt,height,minconf,coin->longestchain,U[unspentind].value));
/*if ( basilisk_addspend(myinfo,coin->symbol,txid,vout,0) != 0 )
{
char str[65]; printf("iguana_unspent_check found unspentind (%u %d) %s\n",outpt.hdrsi,outpt.unspentind,bits256_str(str,txid));
return(1);
} else return(0);*/
{
char str[65]; printf("iguana_unspent_check found unspentind (%u %d) %s\n",outpt.hdrsi,outpt.unspentind,bits256_str(str,txid));
return(1);
} else return(0);*/
return(0);
}
printf("iguana_unspent_check: couldnt find (%d %d)\n",outpt.hdrsi,outpt.unspentind);
@ -1366,9 +1370,9 @@ int32_t iguana_utxoaddr_validate(struct supernet_info *myinfo,struct iguana_info
{
iguana_volatilespurge(coin,&bp->ramchain);
/*sprintf(fname,"%s/%s/accounts/debits.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight);
OS_removefile(fname,0);
sprintf(fname,"%s/%s/accounts/lastspends.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight);
OS_removefile(fname,0);*/
OS_removefile(fname,0);
sprintf(fname,"%s/%s/accounts/lastspends.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight);
OS_removefile(fname,0);*/
iguana_volatilesmap(coin,&bp->ramchain);
}
total = 0;
@ -1512,7 +1516,7 @@ uint64_t iguana_utxoaddr_gen(struct supernet_info *myinfo,struct iguana_info *co
if ( counts[ind] > 0 )
{
qsort(&table[offsets[ind] * UTXOADDR_ITEMSIZE],counts[ind],UTXOADDR_ITEMSIZE,_utxoaddr_cmp);
continue;
continue;
for (j=0; j<counts[ind]; j++)
{
iguana_rwutxoaddr(0,ind,&table[(offsets[ind]+j) * UTXOADDR_ITEMSIZE],&UA);

4
includes/iguana_structs.h

@ -214,8 +214,8 @@ struct iguana_zblockRO
} PACKEDSTRUCT;
#define iguana_blockfields double PoW; \
int32_t height,fpos; uint32_t fpipbits,issued,lag:18,sigsvalid:1,protected:1,peerid:12; \
uint16_t hdrsi:15,mainchain:1,bundlei:11,valid:1,queued:1,txvalid:1,newtx:1,processed:1; \
int32_t height,fpos; uint32_t fpipbits,issued,lag:17,sigsvalid:1,protected:1,peerid:12,processed:1; \
uint16_t hdrsi:15,mainchain:1; int16_t bundlei:12,valid:1,queued:1,txvalid:1,newtx:1; \
UT_hash_handle hh; struct iguana_bundlereq *req; \
struct iguana_blockRO RO

Loading…
Cancel
Save