diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 8235c74f6..644940dee 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -427,25 +427,28 @@ uint32_t iguana_ramchain_addspend(struct iguana_info *coin,RAMCHAIN_FUNC,bits256 printf("iguana_ramchain_addspend error adding external\n"); return(0); } - txidind |= (1 << 31); + //txidind |= (1 << 31); } else if ( ptr != 0 ) - txidind = ptr->hh.itemind; - if ( prev_vout >= 0 && (external= ((txidind >> 31) & 1)) == 0 ) { - if ( txidind > 0 && txidind < ramchain->H.data->numtxids ) + txidind = ptr->hh.itemind; + if ( prev_vout >= 0 && (txidind & (1<<31)) == 0 ) { - if ( (unspentind= T[txidind].firstvout + prev_vout) > 0 && unspentind < ramchain->H.data->numunspents ) + if ( txidind > 0 && txidind < ramchain->H.data->numtxids ) { - value = Ux[unspentind].value; - if ( (pkind= Ux[unspentind].pkind) == 0 || pkind >= ramchain->H.data->numpkinds ) + if ( (unspentind= T[txidind].firstvout + prev_vout) > 0 && unspentind < ramchain->H.data->numunspents ) { - printf("spendind.%d -> unspendind.%d %.8f -> pkind.0x%x\n",spendind,unspentind,dstr(value),pkind); - return(0); - } - } else printf("addspend illegal unspentind.%d vs %d\n",unspentind,ramchain->H.data->numunspents); - } else printf("addspend illegal txidind.%d vs %d\n",txidind,ramchain->H.data->numtxids), exit(-1); + value = Ux[unspentind].value; + if ( (pkind= Ux[unspentind].pkind) == 0 || pkind >= ramchain->H.data->numpkinds ) + { + printf("spendind.%d -> unspendind.%d %.8f -> pkind.0x%x\n",spendind,unspentind,dstr(value),pkind); + return(0); + } + } else printf("addspend illegal unspentind.%d vs %d\n",unspentind,ramchain->H.data->numunspents); + } else printf("addspend illegal txidind.%d vs %d\n",txidind,ramchain->H.data->numtxids), exit(-1); + } } + else printf("unexpected addpsend case: null ptr s%u\n",spendind); if ( ramchain->H.ROflag != 0 ) { iguana_ramchain_txid(coin,RAMCHAIN_ARG,&txid,s); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 3aaa8dac8..92bd6df84 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1270,7 +1270,7 @@ int32_t iguana_balancegen(struct iguana_info *coin,int32_t incremental,struct ig u = &spentU[spent_unspentind]; if ( (spent_pkind= u->pkind) != 0 && spent_pkind < rdata->numpkinds ) spent_value = u->value; - if ( 0 && bp == coin->current ) + if ( spent_hdrsi == 202 && spent_unspentind == 2998402 ) printf("internal spend.%d txidind.%d 1st.%d prevout.%d\n",spendind,txidind,T[txidind].firstvout,s->prevout); } else //if ( i > 0 || j > 0 || k > 0 )