Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ffe4c73e20
  1. 2
      iguana/SuperNET.c
  2. 8
      iguana/iguana_payments.c

2
iguana/SuperNET.c

@ -493,7 +493,7 @@ int32_t iguana_send_supernet(struct iguana_peer *addr,char *jsonstr,int32_t dela
if ( 1 && memcmp(destpub.bytes,GENESIS_PUBKEY.bytes,sizeof(destpub)) == 0 ) if ( 1 && memcmp(destpub.bytes,GENESIS_PUBKEY.bytes,sizeof(destpub)) == 0 )
{ {
qlen = iguana_queue_send(addr,delaymillis,serialized,"SuperNET",datalen,0,0); qlen = iguana_queue_send(addr,delaymillis,serialized,"SuperNET",datalen,0,0);
printf("send broadcast\n"); //printf("send broadcast\n");
} }
else else
{ {

8
iguana/iguana_payments.c

@ -202,7 +202,7 @@ int32_t iguana_bestunspent(struct iguana_info *coin,int32_t *aboveip,int64_t *ab
cJSON *iguana_inputsjson(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,uint64_t amount,int64_t *unspents,int32_t num) cJSON *iguana_inputsjson(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,uint64_t amount,int64_t *unspents,int32_t num)
{ {
cJSON *item,*vins; uint8_t spendscript[IGUANA_MAXSCRIPTSIZE]; struct iguana_txid *T; struct iguana_unspent *U,*u; struct iguana_bundle *bp; struct iguana_ramchain *ramchain; char coinaddr[64],hexstr[IGUANA_MAXSCRIPTSIZE*2+1]; int32_t height,abovei,belowi,i,spendlen,ind,hdrsi; uint32_t txidind,unspentind; int64_t value,above,below,total = 0; int64_t remains = amount; cJSON *item,*vins,*sobj; uint8_t spendscript[IGUANA_MAXSCRIPTSIZE]; struct iguana_txid *T; struct iguana_unspent *U,*u; struct iguana_bundle *bp; struct iguana_ramchain *ramchain; char coinaddr[64],hexstr[IGUANA_MAXSCRIPTSIZE*2+1]; int32_t height,abovei,belowi,i,spendlen,ind,hdrsi; uint32_t txidind,unspentind; int64_t value,above,below,total = 0; int64_t remains = amount;
*totalp = 0; *totalp = 0;
vins = cJSON_CreateArray(); vins = cJSON_CreateArray();
for (i=0; i<num; i++) for (i=0; i<num; i++)
@ -237,11 +237,13 @@ cJSON *iguana_inputsjson(struct supernet_info *myinfo,struct iguana_info *coin,i
{ {
if ( iguana_unspentindfind(coin,coinaddr,spendscript,&spendlen,&amount,&height,T[txidind].txid,u->vout,coin->bundlescount-1) == unspentind && spendlen > 0 ) if ( iguana_unspentindfind(coin,coinaddr,spendscript,&spendlen,&amount,&height,T[txidind].txid,u->vout,coin->bundlescount-1) == unspentind && spendlen > 0 )
{ {
init_hexbytes_noT(hexstr,spendscript,spendlen);
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddbits256(item,"txid",T[txidind].txid); jaddbits256(item,"txid",T[txidind].txid);
jaddnum(item,"vout",u->vout); jaddnum(item,"vout",u->vout);
jaddstr(item,"scriptPubKey",hexstr); sobj = cJSON_CreateObject();
init_hexbytes_noT(hexstr,spendscript,spendlen);
jaddstr(sobj,"hex",hexstr);
jadd(item,"scriptPubKey",sobj);
jaddi(vins,item); jaddi(vins,item);
total += value; total += value;
remains -= value; remains -= value;

Loading…
Cancel
Save