jl777 8 years ago
parent
commit
1cc2392160
  1. 69
      iguana/iguana_payments.c
  2. 9
      iguana/iguana_sign.c

69
iguana/iguana_payments.c

@ -241,75 +241,6 @@ cJSON *iguana_RTinputsjson(struct supernet_info *myinfo,struct iguana_info *coin
//printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains));
if ( remains <= 0 )
break;
/*continue;
if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 )
{
if ( (spendlen= basilisk_unspentfind(myinfo,coin,&txid,&vout,spendscript,outpt,outpt.value)) > 0 )
{
jaddi(vins,iguana_inputjson(txid,vout,spendscript,spendlen));
total += outpt.value;
remains -= outpt.value;
//printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains));
if ( remains <= 0 )
break;
}
continue;
}
if ( (spendlen= _iguana_RTunspentfind(myinfo,coin,&txid,&vout,spendscript,outpt,outpt.value)) > 0 )
{
jaddi(vins,iguana_inputjson(txid,vout,spendscript,spendlen));
total += outpt.value;
remains -= outpt.value;
//printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains));
if ( remains <= 0 )
break;
continue;
}
if ( (bp= coin->bundles[outpt.hdrsi]) == 0 )
{
printf("no bundle.[%d]\n",outpt.hdrsi);
free_json(vins);
return(0);
}
ramchain = &bp->ramchain;
if ( (rdata= ramchain->H.data) == 0 )
continue;
U = RAMCHAIN_PTR(rdata,Uoffset);
T = RAMCHAIN_PTR(rdata,Toffset);
if ( outpt.unspentind > 0 && outpt.unspentind < rdata->numunspents )
{
u = &U[outpt.unspentind];
if ( (txidind= u->txidind) > 0 && txidind < rdata->numtxids )
{
if ( iguana_RTunspentindfind(myinfo,coin,&outpt2,coinaddr,spendscript,&spendlen,&amount,&height,T[txidind].txid,u->vout,coin->bundlescount-1,0) == 0 && spendlen > 0 )
{
jaddi(vins,iguana_inputjson(T[txidind].txid,u->vout,spendscript,spendlen));
total += outpt.value;
remains -= outpt.value;
//printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains));
if ( remains <= 0 )
break;
}
else
{
char str[65];printf("couldnt get script for %s.%d\n",bits256_str(str,T[txidind].txid),u->vout);
free_json(vins);
return(0);
}
}
else
{
printf("illegal txidind.%d [%d]\n",txidind,outpt.hdrsi);
free_json(vins);
return(0);
}
}
else
{
printf("%s illegal unspentind.u%d [%d]\n",coin->symbol,outpt.unspentind,outpt.hdrsi);
free_json(vins);
return(0);
}*/
}
*totalp = total;
return(vins);

9
iguana/iguana_sign.c

@ -698,7 +698,7 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t height,int32_t rwflag,cJ
bits256 iguana_parsetxobj(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *txstartp,uint8_t *serialized,int32_t maxsize,struct iguana_msgtx *msg,cJSON *txobj,struct vin_info *V)
{
int32_t i,numvins,numvouts,len = 0,rwflag=1; cJSON *array=0; bits256 txid; char vpnstr[64];
int32_t i,j,n,numvins,numvouts,len = 0,rwflag=1; cJSON *array=0; bits256 txid; char vpnstr[64];
memset(&txid,0,sizeof(txid));
memset(msg,0,sizeof(*msg));
*txstartp = 0;
@ -727,8 +727,11 @@ bits256 iguana_parsetxobj(struct supernet_info *myinfo,struct iguana_info *coin,
{
for (i=0; i<msg->tx_in; i++)
{
//printf("parsetxobj vinobj.%d starts offset.%d\n",i,len);
len += iguana_parsevinobj(myinfo,coin,&serialized[len],maxsize,&msg->vins[i],jitem(array,i),V!=0?&V[i]:0);
n = iguana_parsevinobj(myinfo,coin,&serialized[len],maxsize,&msg->vins[i],jitem(array,i),V!=0?&V[i]:0);
for (j=0; j<8; j++)
printf("%02x",serialized[len+j]);
char str[65]; printf(" <- vinobj.%d starts offset.%d %s\n",i,len,bits256_str(str,msg->vins[i].prev_hash));
len += n;
}
}
}

Loading…
Cancel
Save