Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
49a8403834
  1. 2
      iguana/iguana777.h
  2. 4
      iguana/iguana_accept.c
  3. 9
      iguana/iguana_instantdex.c
  4. 2
      iguana/iguana_msg.c

2
iguana/iguana777.h

@ -967,7 +967,7 @@ int32_t iguana_uvaltxid(struct supernet_info *myinfo,bits256 *txidp,struct iguan
struct instantdex_accept *instantdex_quotefind(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,bits256 encodedhash);
int32_t instantdex_quoterequest(struct supernet_info *myinfo,struct iguana_info *coin,uint8_t *serialized,int32_t maxlen,struct iguana_peer *addr,bits256 encodedhash);
int32_t instantdex_peerhas_clear(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr);
int32_t instantdex_quote(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,uint8_t *serialized,int32_t recvlen);
int32_t instantdex_quotep2p(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,uint8_t *serialized,int32_t recvlen);
void instantdex_update(struct supernet_info *myinfo);
cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account);
int32_t iguana_interpreter(struct iguana_info *coin,cJSON *logarray,int64_t nLockTime,struct vin_info *V,int32_t numvins);

4
iguana/iguana_accept.c

@ -229,8 +229,8 @@ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_in
{
if ( (len= instantdex_quoterequest(myinfo,coin,&coin->blockspace[sizeof(struct iguana_msghdr)],sizeof(coin->blockspace),msg->addr,msg->hash2)) > 0 )
{
iguana_sethdr((void *)coin->blockspace,coin->chain->netmagic,"quote",&coin->blockspace[sizeof(struct iguana_msghdr)],len);
iguana_msgparser(coin,msg->addr,0,0,0,(void *)coin->blockspace,&coin->blockspace[sizeof(struct iguana_msghdr)],len);
//iguana_sethdr((void *)coin->blockspace,coin->chain->netmagic,"quote",&coin->blockspace[sizeof(struct iguana_msghdr)],len);
//iguana_msgparser(coin,msg->addr,0,0,0,(void *)coin->blockspace,&coin->blockspace[sizeof(struct iguana_msghdr)],len);
iguana_queue_send(coin,msg->addr,0,coin->blockspace,"quote",len,0,0);
}
}

9
iguana/iguana_instantdex.c

@ -822,7 +822,7 @@ int32_t instantdex_inv2data(struct supernet_info *myinfo,struct iguana_info *coi
{
if ( now < ap->offer.expiration && ap->dead == 0 )
{
if ( n < sizeof(hashes)/sizeof(*hashes) )//&& GETBIT(ap->peerhas,addr->addrind) == 0 )
if ( n < sizeof(hashes)/sizeof(*hashes) && GETBIT(ap->peerhas,addr->addrind) == 0 )
hashes[n++] = instantdex_encodehash(ap->offer.base,ap->offer.rel,ap->offer.price64*instantdex_bidaskdir(&ap->offer),ap->orderid,ap->offer.offer64);
queue_enqueue("acceptableQ",&exchange->acceptableQ,&ap->DL,0);
} else free(ap);
@ -882,7 +882,7 @@ int32_t instantdex_quoterequest(struct supernet_info *myinfo,struct iguana_info
return(0);
}
int32_t instantdex_quote(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,uint8_t *serialized,int32_t recvlen)
int32_t instantdex_quotep2p(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,uint8_t *serialized,int32_t recvlen)
{
bits256 orderhash,encodedhash; int32_t checklen; struct instantdex_accept A,*ap; char hexstr[8192];
memset(&A,0,sizeof(A));
@ -892,13 +892,12 @@ int32_t instantdex_quote(struct supernet_info *myinfo,struct iguana_info *coin,s
encodedhash = instantdex_encodehash(A.offer.base,A.offer.rel,A.offer.price64 * instantdex_bidaskdir(&A.offer),A.orderid,A.offer.offer64);
if ( (ap= instantdex_quotefind(myinfo,coin,addr,encodedhash)) == 0 )
{
init_hexbytes_noT(hexstr,serialized,recvlen);
SuperNET_hexmsgadd(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY,hexstr,tai_now(),addr->ipaddr);
printf("add quote here!\n");
}
else
{
SETBIT(ap->peerhas,addr->addrind);
printf("instantdex_quote: got %llx which was already there\n",(long long)encodedhash.txid);
printf("instantdex_quote: got %llu which was already there\n",(long long)encodedhash.txid);
}
} else printf("instantdex_quote: checklen.%d != recvlen.%d\n",checklen,recvlen);
return(checklen);

2
iguana/iguana_msg.c

@ -602,7 +602,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
else if ( strcmp(H->command,"quote") == 0 )
{
printf("got full quote from %s\n",addr->ipaddr);
instantdex_quote(myinfo,coin,addr,data,recvlen);
instantdex_quotep2p(myinfo,coin,addr,data,recvlen);
return(0);
}
}

Loading…
Cancel
Save