diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index f0d48a34d..8235c74f6 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -628,12 +628,11 @@ void *iguana_ramchain_offset(char *fname,void *dest,uint8_t *lhash,FILE *fp,uint { startfpos = ftell(fp); #ifdef __PNACL__ - if ( 0 ) + if ( 1 ) { int32_t i,numretries = 5; for (i=0; itxid.bytes,sizeof(*txidp)) != 0 ) { - for (i=0; itxid)); + //for (i=0; itxid)); return(-1); } return(len); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 1562aafb4..c0bcda1e7 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -829,7 +829,7 @@ char *iguana_bundleaddrs(struct iguana_info *coin,int32_t hdrsi) int64_t iguana_pkhashbalance(struct iguana_info *coin,cJSON *array,int64_t *spentp,int32_t *nump,struct iguana_ramchain *ramchain,struct iguana_pkhash *p,uint32_t lastunspentind,uint8_t rmd160[20],char *coinaddr,uint8_t *pubkey33,int32_t hdrsi,int32_t height) { - struct iguana_unspent *U; int32_t spentheight; uint32_t unspentind; int64_t balance = 0; struct iguana_txid *T; struct iguana_ramchaindata *rdata = 0; + struct iguana_unspent *U; int32_t spentheight; uint32_t pkind=0,unspentind; int64_t spent = 0, balance = 0; struct iguana_txid *T; struct iguana_account *A2; struct iguana_ramchaindata *rdata = 0; *spentp = *nump = 0; if ( 0 && ramchain == &coin->RTramchain && coin->RTramchain_busy != 0 ) { @@ -853,9 +853,17 @@ int64_t iguana_pkhashbalance(struct iguana_info *coin,cJSON *array,int64_t *spen balance += U[unspentind].value; if ( array != 0 ) jaddi(array,iguana_unspentjson(coin,hdrsi,unspentind,T,&U[unspentind],rmd160,coinaddr,pubkey33)); - } else (*spentp) += U[unspentind].value; + } else spent += U[unspentind].value; + if ( p->pkind != U[unspentind].pkind ) + printf("warning: [%d] p->pkind.%u vs U->pkind.%u for u%d\n",hdrsi,p->pkind,U[unspentind].pkind,unspentind); unspentind = U[unspentind].prevunspentind; } + if ( (A2= ramchain->A) != 0 ) + { + printf("[%d] spent %.8f (%.8f) vs A2[%u] %.8f\n",hdrsi,dstr(spent),dstr(*spentp),pkind,dstr(A2[pkind].total)); + } + (*spentp) += spent; + balance -= spent; return(balance); } diff --git a/iguana/main.c b/iguana/main.c index 8d3b36cb4..7bda063b3 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -68,7 +68,7 @@ int32_t HDRnet,netBLOCKS; cJSON *API_json; #ifdef __PNACL__ -char GLOBAL_TMPDIR[512] = "/tmp"; +char GLOBAL_TMPDIR[512] = "/DB/tmp"; char GLOBAL_DBDIR[512] = "/DB"; char GLOBAL_HELPDIR[512] = "/DB/help"; char GLOBAL_VALIDATEDIR[512] = "/DB/purgeable";