Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
65e47a28c2
  1. 18
      iguana/iguana_realtime.c
  2. 4
      iguana/iguana_unspents.c

18
iguana/iguana_realtime.c

@ -18,6 +18,7 @@
void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp)
{
int32_t hdrsi;
portable_mutex_lock(&coin->RTmutex);
if ( coin->utxotable != 0 )
{
printf("free RTramchain\n");
@ -39,6 +40,7 @@ void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp)
coin->RTdatabad = 0;
printf("done RTramchain\n");
}
portable_mutex_unlock(&coin->RTmutex);
}
void *iguana_ramchainfile(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *R,struct iguana_bundle *bp,int32_t bundlei,struct iguana_block *block)
@ -67,6 +69,7 @@ void *iguana_ramchainfile(struct supernet_info *myinfo,struct iguana_info *coin,
void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_bundle *bp)
{
uint32_t i,changed = 0; struct iguana_ramchaindata *rdata; struct iguana_ramchain *dest = &coin->RTramchain; struct iguana_blockRO *B; struct iguana_bundle *tmpbp;
portable_mutex_lock(&coin->RTmutex);
if ( (rdata= dest->H.data) != 0 )
{
i = 0;
@ -108,6 +111,7 @@ void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_b
sleep(1);
}
}
portable_mutex_unlock(&coin->RTmutex);
}
void iguana_rdataset(struct iguana_ramchain *dest,struct iguana_ramchaindata *rdest,struct iguana_ramchain *src)
@ -225,21 +229,21 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
usleep(100000);
return(0);
}
portable_mutex_lock(&coin->RTmutex);
//portable_mutex_lock(&coin->RTmutex);
for (i=0; i<coin->bundlescount-1; i++)
{
if ( (bp= coin->bundles[i]) != 0 && (i > 0 && bp->utxofinish == 0) && bp != coin->current )
{
if ( iguana_spendvectors(myinfo,coin,bp,&bp->ramchain,0,bp->n,0,0) < 0 )
{
portable_mutex_unlock(&coin->RTmutex);
//portable_mutex_unlock(&coin->RTmutex);
printf("error generating spendvectors.[%d], skipping\n",i);
return(0);
} // else printf("generated UTXO.[%d]\n",i);
coin->spendvectorsaved = 1;
}
}
portable_mutex_unlock(&coin->RTmutex);
//portable_mutex_unlock(&coin->RTmutex);
bp = coin->current;
if ( bp == 0 || iguana_validated(coin) < bp->hdrsi )
{
@ -350,9 +354,9 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
//printf("RTgenesis verified\n");
if ( (coin->RTheight % coin->chain->bundlesize) > 3 )
{
portable_mutex_lock(&coin->RTmutex);
//portable_mutex_lock(&coin->RTmutex);
iguana_RTspendvectors(myinfo,coin,bp);
portable_mutex_unlock(&coin->RTmutex);
//portable_mutex_unlock(&coin->RTmutex);
coin->RTgenesis = (uint32_t)time(NULL);
}
}
@ -367,7 +371,7 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
if ( coin->RTdatabad != 0 )
{
bits256 lastbundle;
portable_mutex_lock(&coin->RTmutex);
//portable_mutex_lock(&coin->RTmutex);
printf("START DATABAD fixing\n");
iguana_RTramchainfree(coin,bp);
if ( coin->RTdatabad < 0 )
@ -387,7 +391,7 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
}
iguana_RTramchainalloc("RTbundle",coin,bp);
printf("DONE DATABAD fixing\n");
portable_mutex_unlock(&coin->RTmutex);
//portable_mutex_unlock(&coin->RTmutex);
}
return(flag);
}

4
iguana/iguana_unspents.c

@ -98,7 +98,7 @@ int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *
int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,uint8_t *spendscript,int32_t *spendlenp,uint64_t *valuep,int32_t *heightp,bits256 txid,int32_t vout,int32_t lasthdrsi,int32_t mempool)
{
struct iguana_txid *tp,TX; struct gecko_memtx *memtx; struct iguana_pkhash *P; struct iguana_unspent *U; struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int64_t RTspend; int64_t value; int32_t pkind,hdrsi,firstvout,spentheight,flag=0,unspentind = -1;
portable_mutex_lock(&coin->RTmutex);
//portable_mutex_lock(&coin->RTmutex);
if ( valuep != 0 )
*valuep = 0;
if ( coinaddr != 0 )
@ -143,7 +143,7 @@ int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *c
}
}
}
portable_mutex_unlock(&coin->RTmutex);
//portable_mutex_unlock(&coin->RTmutex);
return(unspentind);
}

Loading…
Cancel
Save