Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
224c48b097
  1. 32
      iguana/iguana_tx.c

32
iguana/iguana_tx.c

@ -117,22 +117,26 @@ int32_t iguana_voutscript(struct iguana_info *coin,struct iguana_bundle *bp,uint
int32_t iguana_voutset(struct iguana_info *coin,uint8_t *scriptspace,char *asmstr,int32_t height,struct iguana_msgvout *vout,struct iguana_txid *tx,int32_t i) int32_t iguana_voutset(struct iguana_info *coin,uint8_t *scriptspace,char *asmstr,int32_t height,struct iguana_msgvout *vout,struct iguana_txid *tx,int32_t i)
{ {
struct iguana_ramchaindata *rdata=0; uint32_t unspentind,scriptlen = 0; struct iguana_bundle *bp; struct iguana_ramchaindata *rdata=0; uint32_t unspentind,scriptlen = 0; struct iguana_bundle *bp;
struct iguana_unspent *u,*U; struct iguana_pkhash *P; int32_t err = 0; struct iguana_unspent *u,*U; struct iguana_pkhash *P; struct iguana_ramchain *ramchain; int32_t err = 0;
memset(vout,0,sizeof(*vout)); memset(vout,0,sizeof(*vout));
if ( height >= 0 && height < coin->chain->bundlesize*coin->bundlescount && (bp= coin->bundles[height / coin->chain->bundlesize]) != 0 && (rdata= bp->ramchain.H.data) != 0 && i < tx->numvouts ) if ( height >= 0 && height < coin->chain->bundlesize*coin->bundlescount && (bp= coin->bundles[height / coin->chain->bundlesize]) != 0 )
{ {
U = RAMCHAIN_PTR(rdata,Uoffset); ramchain = (bp == coin->current) ? &coin->RTramchain : &bp->ramchain;
P = RAMCHAIN_PTR(rdata,Poffset); if ( (rdata= ramchain->H.data) != 0 && i < tx->numvouts )
//U = (void *)(long)((long)rdata + rdata->Uoffset); {
//P = (void *)(long)((long)rdata + rdata->Poffset); U = RAMCHAIN_PTR(rdata,Uoffset);
unspentind = (tx->firstvout + i); P = RAMCHAIN_PTR(rdata,Poffset);
u = &U[unspentind]; //U = (void *)(long)((long)rdata + rdata->Uoffset);
if ( u->txidind != tx->txidind || u->vout != i || u->hdrsi != height / coin->chain->bundlesize ) //P = (void *)(long)((long)rdata + rdata->Poffset);
printf("iguana_voutset: txidind mismatch %d vs %d || %d vs %d || (%d vs %d)\n",u->txidind,u->txidind,u->vout,i,u->hdrsi,height / coin->chain->bundlesize); unspentind = (tx->firstvout + i);
vout->value = u->value; u = &U[unspentind];
vout->pk_script = scriptspace; if ( u->txidind != tx->txidind || u->vout != i || u->hdrsi != height / coin->chain->bundlesize )
scriptlen = iguana_voutscript(coin,bp,scriptspace,asmstr,u,&P[u->pkind],i); printf("iguana_voutset: txidind mismatch %d vs %d || %d vs %d || (%d vs %d)\n",u->txidind,u->txidind,u->vout,i,u->hdrsi,height / coin->chain->bundlesize);
} else printf("iguana_voutset unexpected path rdata.%p i.%d %d\n",rdata,i,tx->numvouts); vout->value = u->value;
vout->pk_script = scriptspace;
scriptlen = iguana_voutscript(coin,bp,scriptspace,asmstr,u,&P[u->pkind],i);
} else printf("iguana_voutset unexpected path rdata.%p i.%d %d\n",rdata,i,tx->numvouts);
}
vout->pk_scriptlen = scriptlen; vout->pk_scriptlen = scriptlen;
if ( err != 0 ) if ( err != 0 )
return(-err); return(-err);

Loading…
Cancel
Save