Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b3117026d7
  1. 2
      basilisk/basilisk_swap.c
  2. 8
      iguana/iguana_payments.c
  3. 2
      iguana/iguana_realtime.c
  4. 12
      iguana/iguana_sign.c
  5. 4
      includes/iguana_funcs.h

2
basilisk/basilisk_swap.c

@ -287,7 +287,7 @@ int32_t basilisk_rawtx_spendscript(struct supernet_info *myinfo,struct basilisk_
printf("%s rawtx data compare error, len %d vs %d\n",rawtx->name,rawtx->datalen,datalen);
return(-1);
}
if ( (txobj= bitcoin_data2json(rawtx->coin,&rawtx->signedtxid,&rawtx->msgtx,rawtx->extraspace,sizeof(rawtx->extraspace),rawtx->txbytes,rawtx->datalen)) != 0 )
if ( (txobj= bitcoin_data2json(rawtx->coin,&rawtx->signedtxid,&rawtx->msgtx,rawtx->extraspace,sizeof(rawtx->extraspace),rawtx->txbytes,rawtx->datalen,0)) != 0 )
{
rawtx->actualtxid = rawtx->signedtxid;
char str[65]; printf("got txid.%s\n",bits256_str(str,rawtx->signedtxid));

8
iguana/iguana_payments.c

@ -818,7 +818,7 @@ HASH_AND_INT(bitcoinrpc,getrawtransaction,txid,verbose)
if ( verbose != 0 )
{
extraspace = calloc(1,extralen);
txobj = bitcoin_hex2json(coin,&checktxid,0,txbytes,extraspace,extralen,0);
txobj = bitcoin_hex2json(coin,&checktxid,0,txbytes,extraspace,extralen,0,0);
free(extraspace);
free(txbytes);
if ( txobj != 0 )
@ -885,7 +885,7 @@ char *iguana_validaterawtx(struct supernet_info *myinfo,struct iguana_info *coin
if ( (strlen(rawtx) & 1) != 0 )
return(clonestr("{\"error\":\"rawtx hex has odd length\"}"));
memset(msgtx,0,sizeof(*msgtx));
if ( (txobj= bitcoin_hex2json(coin,&msgtx->txid,msgtx,rawtx,extraspace,extralen,0)) != 0 )
if ( (txobj= bitcoin_hex2json(coin,&msgtx->txid,msgtx,rawtx,extraspace,extralen,0,0)) != 0 )
{
//printf("txobj.(%s)\n",jprint(txobj,0));
if ( (checkstr= bitcoin_json2hex(myinfo,coin,&txid,txobj,0)) != 0 )
@ -900,7 +900,7 @@ char *iguana_validaterawtx(struct supernet_info *myinfo,struct iguana_info *coin
break;
jaddnum(retjson,"mismatch position",i);
jadd(retjson,"origtx",txobj);
if ( (txobj= bitcoin_hex2json(coin,&txid,msgtx,checkstr,extraspace,extralen,0)) != 0 )
if ( (txobj= bitcoin_hex2json(coin,&txid,msgtx,checkstr,extraspace,extralen,0,0)) != 0 )
jadd(retjson,"checktx",txobj);
free(checkstr);
return(jprint(retjson,1));
@ -986,7 +986,7 @@ STRING_ARG(bitcoinrpc,decoderawtransaction,rawtx)
if ( (strlen(rawtx) & 1) != 0 )
return(clonestr("{\"error\":\"rawtx hex has odd length\"}"));
extraspace = calloc(1,extralen);
txobj = bitcoin_hex2json(coin,&txid,0,rawtx,extraspace,extralen,0);
txobj = bitcoin_hex2json(coin,&txid,0,rawtx,extraspace,extralen,0,0);
free(extraspace);
//char str[65]; printf("got txid.(%s)\n",bits256_str(str,txid));
}

2
iguana/iguana_realtime.c

@ -213,7 +213,7 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
struct iguana_block *block=0; struct iguana_blockRO *B; struct iguana_ramchain *dest=0,blockR;
if ( coin->peers == 0 && coin->virtualchain == 0 )
return(0);
offset = (strcmp("BTCD",coin->symbol) == 0);
offset = 0;//(strcmp("BTCD",coin->symbol) == 0);
if ( coin->current != 0 && (coin->blocks.hwmchain.height % coin->chain->bundlesize) == coin->chain->bundlesize-1 && coin->blocks.hwmchain.height/coin->chain->bundlesize == coin->longestchain/coin->chain->bundlesize )
{
block = coin->current->blocks[coin->current->n - 1];

12
iguana/iguana_sign.c

@ -566,7 +566,7 @@ char *bitcoin_json2hex(struct supernet_info *myinfo,struct iguana_info *coin,bit
return(txbytes);
}
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)
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,cJSON *vins)
{
int32_t n; char vpnstr[64]; struct iguana_msgtx M; cJSON *txobj;
if ( coin == 0 || serialized == 0 )
@ -577,7 +577,7 @@ cJSON *bitcoin_data2json(struct iguana_info *coin,bits256 *txidp,struct iguana_m
memset(msgtx,0,sizeof(M));
vpnstr[0] = 0;
memset(txidp,0,sizeof(*txidp));
if ( (n= iguana_rwmsgtx(coin,0,txobj,serialized,len,msgtx,txidp,vpnstr,extraspace,extralen,0)) <= 0 )
if ( (n= iguana_rwmsgtx(coin,0,txobj,serialized,len,msgtx,txidp,vpnstr,extraspace,extralen,vins)) <= 0 )
{
free_json(txobj);
txobj = cJSON_CreateObject();
@ -587,7 +587,7 @@ cJSON *bitcoin_data2json(struct iguana_info *coin,bits256 *txidp,struct iguana_m
return(txobj);
}
cJSON *bitcoin_hex2json(struct iguana_info *coin,bits256 *txidp,struct iguana_msgtx *msgtx,char *txbytes,uint8_t *extraspace,int32_t extralen,uint8_t *origserialized)
cJSON *bitcoin_hex2json(struct iguana_info *coin,bits256 *txidp,struct iguana_msgtx *msgtx,char *txbytes,uint8_t *extraspace,int32_t extralen,uint8_t *origserialized,cJSON *vins)
{
int32_t len; uint8_t *serialized; cJSON *txobj;
if ( coin == 0 || txbytes == 0 )
@ -596,7 +596,7 @@ cJSON *bitcoin_hex2json(struct iguana_info *coin,bits256 *txidp,struct iguana_ms
if ( (serialized= origserialized) == 0 )
serialized = calloc(1,len);
decode_hex(serialized,len,txbytes);
txobj = bitcoin_data2json(coin,txidp,msgtx,extraspace,extralen,serialized,len);
txobj = bitcoin_data2json(coin,txidp,msgtx,extraspace,extralen,serialized,len,vins);
if ( serialized != origserialized )
free(serialized);
return(txobj);
@ -1096,9 +1096,9 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
extraspace = malloc(extralen);
memset(msgtx,0,sizeof(*msgtx));
decode_hex(serialized,len,rawtx);
if ( (txobj= bitcoin_hex2json(coin,&txid,msgtx,rawtx,extraspace,extralen,serialized4)) != 0 )
if ( (txobj= bitcoin_hex2json(coin,&txid,msgtx,rawtx,extraspace,extralen,serialized4,vins)) != 0 )
{
//printf("txobj.(%s)\n",jprint(txobj,0));
printf("txobj.(%s)\n",jprint(txobj,0));
if ( (checkstr= bitcoin_json2hex(myinfo,coin,&txid,txobj,0)) != 0 )
{
if ( strcmp(rawtx,checkstr) != 0 )

4
includes/iguana_funcs.h

@ -297,7 +297,7 @@ int32_t iguana_rwblockhdr(int32_t rwflag,uint8_t zcash,uint8_t *serialized,struc
void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen);
int32_t bitcoin_checklocktimeverify(uint8_t *script,int32_t n,uint32_t locktime);
struct bitcoin_spend *iguana_spendset(struct supernet_info *myinfo,struct iguana_info *coin,int64_t amount,int64_t txfee,cJSON *addresses,int32_t minconf);
cJSON *bitcoin_hex2json(struct iguana_info *coin,bits256 *txidp,struct iguana_msgtx *msgtx,char *txbytes,uint8_t *extrapace,int32_t extralen,uint8_t *serialized);
cJSON *bitcoin_hex2json(struct iguana_info *coin,bits256 *txidp,struct iguana_msgtx *msgtx,char *txbytes,uint8_t *extrapace,int32_t extralen,uint8_t *serialized,cJSON *vins);
cJSON *iguana_signtx(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,char **signedtxp,struct bitcoin_spend *spend,cJSON *txobj,cJSON *vins);
void iguana_addscript(struct iguana_info *coin,cJSON *dest,uint8_t *script,int32_t scriptlen,char *fieldname);
bits256 iguana_genesis(struct iguana_info *coin,struct iguana_chain *chain);
@ -472,7 +472,7 @@ void iguana_unspentslock(struct supernet_info *myinfo,struct iguana_info *coin,c
char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t satoshis,char *changeaddr,int64_t txfee,cJSON *addresses,int32_t minconf,uint8_t *opreturn,int32_t oplen,int64_t burnamount,char *remoteaddr);
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);
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,cJSON *vins);
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);
int32_t iguana_unspent_check(struct supernet_info *myinfo,struct iguana_info *coin,uint16_t hdrsi,uint32_t unspentind);
char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *valsobj);

Loading…
Cancel
Save