Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f76e2eddf6
  1. 25
      iguana/iguana_payments.c

25
iguana/iguana_payments.c

@ -407,6 +407,7 @@ char *iguana_rawtxissue(struct supernet_info *myinfo,uint32_t rawtxtag,char *sym
jadd64bits(valsobj,"txfee",txfee);
jaddnum(valsobj,"minconf",minconf);
jaddnum(valsobj,"locktime",locktime);
jaddnum(valsobj,"port",coin->chain->portp2p);
jadd(hexjson,"vals",valsobj);
jaddstr(hexjson,"agent","iguana");
jaddstr(hexjson,"method","rawtx");
@ -538,11 +539,12 @@ char *iguana_createrawtx(struct supernet_info *myinfo,uint32_t rawtxtag,char *sy
STRING_ARRAY_OBJ_STRING(iguana,rawtx,changeaddr,addresses,vals,spendscriptstr)
{
cJSON *vins=0,*retjson,*hexjson,*valsobj; char buf[2*IGUANA_MAXSCRIPTSIZE+8192],*str,*rawtx=0,*symbol=0; int64_t txfee,satoshis; uint32_t i,locktime,minconf,rawtxtag; struct iguana_peer *addr;
cJSON *vins=0,*retjson,*hexjson,*valsobj; char buf[2*IGUANA_MAXSCRIPTSIZE+8192],*str,*rawtx=0,*symbol=0; int64_t txfee,satoshis; uint16_t port; uint32_t i,j,locktime,minconf,rawtxtag; struct iguana_peer *addr;
//printf("RAWTX changeaddr.%s (%s) remote.(%s)\n",changeaddr==0?"":changeaddr,jprint(json,0),remoteaddr);
retjson = cJSON_CreateObject();
if ( spendscriptstr != 0 && spendscriptstr[0] != 0 && (symbol= jstr(vals,"coin")) != 0 )
{
port = juint(vals,"port");
minconf = juint(vals,"minconf");
locktime = juint(vals,"locktime");
satoshis = j64bits(vals,"amount");
@ -575,17 +577,22 @@ STRING_ARRAY_OBJ_STRING(iguana,rawtx,changeaddr,addresses,vals,spendscriptstr)
jaddbits256(retjson,"categoryhash",myinfo->bitcoin_category);
jaddnum(retjson,"timeout",5000);
jaddstr(retjson,"hexmsg",buf);
for (i=0; i<IGUANA_MAXPEERS; i++)
for (j=0; j<IGUANA_MAXCOINS; j++)
{
if ( addr->ipbits != 0 )
printf("i.%d (%s) vs (%s)\n",i,addr->ipaddr,remoteaddr);
if ( (addr= &coin->peers.active[i]) != 0 && addr->usock >= 0 )
if ( (coin= Coins[j]) == 0 )
continue;
for (i=0; i<IGUANA_MAXPEERS; i++)
{
if ( addr->supernet != 0 && strcmp(addr->ipaddr,remoteaddr) == 0 )
if ( addr->ipbits != 0 )
printf("i.%d (%s) vs (%s)\n",i,addr->ipaddr,remoteaddr);
if ( (addr= &coin->peers.active[i]) != 0 && addr->usock >= 0 )
{
printf("send back rawtx_result addr->supernet.%u\n",addr->supernet);
iguana_send_supernet(addr,jprint(retjson,0),0);
break;
if ( addr->supernet != 0 && (port == 0 || port == addr->A.port) && strcmp(addr->ipaddr,remoteaddr) == 0 )
{
printf("send back rawtx_result addr->supernet.%u\n",addr->supernet);
iguana_send_supernet(addr,jprint(retjson,0),0);
break;
}
}
}
}

Loading…
Cancel
Save