Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
64b0785091
  1. 2
      iguana/btcd
  2. 2
      iguana/main.c
  3. 15
      iguana/swaps/iguana_BTCswap.c

2
iguana/btcd

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":-1,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTCD\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":256}" curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTCD\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":256,\"RELAY\":1,\"VALIDATE\":1}"

2
iguana/main.c

@ -306,7 +306,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,cJSON *json,char *remote
timeout = IGUANA_JSONTIMEOUT; timeout = IGUANA_JSONTIMEOUT;
if ( (method= jstr(json,"method")) != 0 && strcmp(method,"DHT") == 0 && remoteaddr != 0 && (hexmsg= jstr(json,"hexmsg")) != 0 ) if ( (method= jstr(json,"method")) != 0 && strcmp(method,"DHT") == 0 && remoteaddr != 0 && (hexmsg= jstr(json,"hexmsg")) != 0 )
{ {
printf("hexmsgprocess myinfo.%p\n",myinfo); //printf("hexmsgprocess myinfo.%p\n",myinfo);
SuperNET_hexmsgprocess(myinfo,0,json,hexmsg,remoteaddr); SuperNET_hexmsgprocess(myinfo,0,json,hexmsg,remoteaddr);
return(clonestr("{\"result\":\"processed remote DHT\"}")); return(clonestr("{\"result\":\"processed remote DHT\"}"));
} }

15
iguana/swaps/iguana_BTCswap.c

@ -589,13 +589,12 @@ void instantdex_swapbits256update(bits256 *txidp,cJSON *argjson,char *fieldname)
void instantdex_newjson(struct supernet_info *myinfo,struct bitcoin_swapinfo *swap,cJSON *newjson) void instantdex_newjson(struct supernet_info *myinfo,struct bitcoin_swapinfo *swap,cJSON *newjson)
{ {
uint8_t pubkey[33];
jaddnum(newjson,"have",swap->havestate); jaddnum(newjson,"have",swap->havestate);
if ( swap->choosei >= 0 ) if ( swap->choosei >= 0 )
jaddnum(newjson,"mychoosei",swap->choosei); jaddnum(newjson,"mychoosei",swap->choosei);
if ( bits256_nonz(swap->pubAm) != 0 ) if ( swap->otherchoosei >= 0 )
jaddbits256(newjson,"pubAm",swap->pubAm); jaddnum(newjson,"otherchoosei",swap->otherchoosei);
if ( bits256_nonz(swap->pubBn) != 0 )
jaddbits256(newjson,"pubBn",swap->pubBn);
if ( swap->myfee != 0 && jobj(newjson,"feetx") == 0 && (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEOTHERFEE) == 0 ) if ( swap->myfee != 0 && jobj(newjson,"feetx") == 0 && (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEOTHERFEE) == 0 )
{ {
jaddbits256(newjson,"feetxid",swap->myfee->txid); jaddbits256(newjson,"feetxid",swap->myfee->txid);
@ -612,9 +611,17 @@ void instantdex_newjson(struct supernet_info *myinfo,struct bitcoin_swapinfo *sw
} }
jaddbits256(newjson,"A0",swap->mypubs[0]); jaddbits256(newjson,"A0",swap->mypubs[0]);
jaddbits256(newjson,"A1",swap->mypubs[1]); jaddbits256(newjson,"A1",swap->mypubs[1]);
if ( bits256_nonz(swap->pubAm) == 0 && swap->otherchoosei >= 0 )
swap->pubAm = bitcoin_pubkey33(myinfo->ctx,pubkey,swap->privkeys[swap->otherchoosei]);
if ( bits256_nonz(swap->pubAm) != 0 )
jaddbits256(newjson,"pubAm",swap->pubAm);
} }
else else
{ {
if ( bits256_nonz(swap->pubBn) == 0 && swap->otherchoosei >= 0 )
swap->pubBn = bitcoin_pubkey33(myinfo->ctx,pubkey,swap->privkeys[swap->otherchoosei]);
if ( bits256_nonz(swap->pubBn) != 0 )
jaddbits256(newjson,"pubBn",swap->pubBn);
jaddbits256(newjson,"B0",swap->mypubs[0]); jaddbits256(newjson,"B0",swap->mypubs[0]);
jaddbits256(newjson,"B1",swap->mypubs[1]); jaddbits256(newjson,"B1",swap->mypubs[1]);
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEDEPOSIT) == 0 && swap->deposit != 0 && jobj(newjson,"deposit") == 0 ) if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEDEPOSIT) == 0 && swap->deposit != 0 && jobj(newjson,"deposit") == 0 )

Loading…
Cancel
Save