Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
77d4c57b68
  1. 5
      iguana/iguana_unspents.c
  2. 8
      iguana/iguana_volatiles.c
  3. 2
      includes/iguana_funcs.h

5
iguana/iguana_unspents.c

@ -21,10 +21,10 @@
#include "exchanges/bitcoin.h"
int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,int16_t hdrsi,uint32_t unspentind)
int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *spentheightp,bits256 *txidp,int32_t *voutp,int16_t hdrsi,uint32_t unspentind)
{
struct iguana_ramchaindata *rdata=0; struct iguana_bundle *bp; struct iguana_unspent *U,*u; struct iguana_txid *T,*t;
*voutp = -1;
*voutp = *spentheightp = -1;
memset(txidp,0,sizeof(*txidp));
if ( hdrsi < coin->bundlescount-1 )
rdata = coin->RTramchain.H.data;
@ -41,6 +41,7 @@ int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *
if ( unspentind >= t->firstvout )
{
*txidp = t->txid;
*spentheightp = (hdrsi * coin->chain->bundlesize) + t->bundlei;
*voutp = unspentind - t->firstvout;
return(0);
}

8
iguana/iguana_volatiles.c

@ -146,11 +146,15 @@ int32_t iguana_spentflag(struct supernet_info *myinfo,struct iguana_info *coin,i
if ( (rdata= ramchain->H.data) == 0 )
return(0);
numunspents = rdata->numunspents;
if ( iguana_unspentind2txid(myinfo,coin,&txid,&vout,spent_hdrsi,spent_unspentind) == 0 && basilisk_addspend(myinfo,coin->symbol,txid,vout,0) != 0 )
return(-1);
utxo = iguana_utxofind(coin,spent_hdrsi,spent_unspentind,&RTspentflag,0);
if ( RTspentflag != 0 )
*RTspendp = (amount == 0) ? coin->txfee : amount;
if ( iguana_unspentind2txid(myinfo,coin,spentheightp,&txid,&vout,spent_hdrsi,spent_unspentind) == 0 && basilisk_addspend(myinfo,coin->symbol,txid,vout,0) != 0 )
{
char str[65];
printf("found unspentind (%u %d) %s\n",spent_hdrsi,spent_unspentind,bits256_str(str,txid));
return(-1);
}
if ( utxo.spentflag != 0 && utxo.fromheight == 0 )
{
printf("illegal unspentind.%u vs %u hdrs.%d zero fromheight?\n",spent_unspentind,numunspents,spent_hdrsi);

2
includes/iguana_funcs.h

@ -472,7 +472,7 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS
int64_t datachain_update(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,uint8_t rmd160[20],int64_t crypto777_payment,uint8_t type,int32_t height,uint64_t hdrsi_unspentind,int64_t burned,uint32_t fileid,uint64_t scriptpos,int32_t scriptlen,bits256 txid,int32_t vout);
void datachain_update_spend(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,int32_t height,bits256 txid,int32_t vout,uint8_t rmd160[20],int64_t value);
cJSON *bitcoin_data2json(struct iguana_info *coin,bits256 *txidp,struct iguana_msgtx *msgtx,uint8_t *extraspace,int32_t extralen,uint8_t *serialized,int32_t len);
int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,int16_t hdrsi,uint32_t unspentind);
int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *spentheightp,bits256 *txidp,int32_t *voutp,int16_t hdrsi,uint32_t unspentind);
char *iguana_signrawtx(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *signedtxidp,int32_t *completedp,cJSON *vins,char *rawtx,cJSON *privkey,struct vin_info *V);
bits256 scrypt_blockhash(const void *input);

Loading…
Cancel
Save