@ -769,7 +769,7 @@ void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo
qp - > tradeid = LP_Alicequery . tradeid ;
LP_Alicereserved = * qp ;
LP_alicequery_clear ( ) ;
printf ( " send CONNECT \n " ) ;
//printf("send CONNECT\n");
LP_query ( ctx , myipaddr , mypubsock , " connect " , qp ) ;
} else printf ( " LP_reserved %llu price %.8f vs maxprice %.8f \n " , ( long long ) qp - > aliceid , price , maxprice ) ;
} //else printf("probably a timeout, reject reserved due to not eligible.%d or mismatched quote price %.8f vs maxprice %.8f\n",LP_alice_eligible(qp->quotetime),price,maxprice);
@ -835,7 +835,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru
double price , qprice , myprice , bestprice , range , bid , ask ; struct iguana_info * coin ; struct LP_utxoinfo A , B , * autxo , * butxo ; cJSON * reqjson ; char str [ 65 ] ; struct LP_address_utxo * utxos [ 1000 ] ; int32_t r , counter , max = ( int32_t ) ( sizeof ( utxos ) / sizeof ( * utxos ) ) ;
* newqp = * qp ;
qp = newqp ;
printf ( " bob %s received REQUEST.(%llu) \n " , bits256_str ( str , G . LP_mypub25519 ) , ( long long ) qp - > aliceid ) ;
//printf("bob %s received REQUEST.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid);
if ( ( coin = LP_coinfind ( qp - > srccoin ) ) = = 0 )
return ( 0 ) ;
if ( ( myprice = LP_trades_bobprice ( & bid , & ask , qp ) ) = = 0. )
@ -906,7 +906,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru
jaddstr ( reqjson , " method " , " reserved " ) ;
LP_reserved_msg ( 1 , qp - > srccoin , qp - > destcoin , qp - > desthash , jprint ( reqjson , 0 ) ) ;
free_json ( reqjson ) ;
printf ( " Send RESERVED id.%llu \n " , ( long long ) qp - > aliceid ) ;
//printf("Send RESERVED id.%llu\n",(long long)qp->aliceid);
return ( qp ) ;
} else printf ( " request processing selected ineligible utxos? \n " ) ;
return ( 0 ) ;
@ -915,7 +915,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru
struct LP_quoteinfo * LP_trades_gotreserved ( void * ctx , struct LP_quoteinfo * qp , struct LP_quoteinfo * newqp )
{
char * retstr ;
char str [ 65 ] ; printf ( " alice %s received RESERVED.(%llu) %.8f \n " , bits256_str ( str , G . LP_mypub25519 ) , ( long long ) qp - > aliceid , ( double ) qp - > destsatoshis / ( qp - > satoshis + 1 ) ) ;
//char str[65]; printf("alice %s received RESERVED.(%llu) %.8f\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid,(double)qp->destsatoshis/(qp->satoshis+1));
* newqp = * qp ;
qp = newqp ;
if ( LP_trades_alicevalidate ( ctx , qp ) > 0. )
@ -931,7 +931,7 @@ struct LP_quoteinfo *LP_trades_gotreserved(void *ctx,struct LP_quoteinfo *qp,str
struct LP_quoteinfo * LP_trades_gotconnect ( void * ctx , struct LP_quoteinfo * qp , struct LP_quoteinfo * newqp , char * pairstr )
{
double myprice , qprice , bid , ask ; struct iguana_info * coin ;
char str [ 65 ] ; printf ( " bob %s received CONNECT.(%llu) \n " , bits256_str ( str , G . LP_mypub25519 ) , ( long long ) qp - > aliceid ) ;
//char str[65]; printf("bob %s received CONNECT.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid);
* newqp = * qp ;
qp = newqp ;
if ( ( coin = LP_coinfind ( qp - > srccoin ) ) = = 0 )
@ -951,7 +951,7 @@ struct LP_quoteinfo *LP_trades_gotconnect(void *ctx,struct LP_quoteinfo *qp,stru
struct LP_quoteinfo * LP_trades_gotconnected ( void * ctx , struct LP_quoteinfo * qp , struct LP_quoteinfo * newqp , char * pairstr )
{
char * retstr ;
char str [ 65 ] ; printf ( " alice %s received CONNECTED.(%llu) \n " , bits256_str ( str , G . LP_mypub25519 ) , ( long long ) qp - > aliceid ) ;
//char str[65]; printf("alice %s received CONNECTED.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid);
* newqp = * qp ;
qp = newqp ;
if ( LP_trades_alicevalidate ( ctx , qp ) > 0. )
@ -1034,7 +1034,7 @@ void LP_tradesloop(void *ctx)
tp - > connectsent = now ;
//printf("send LP_connect aliceid.%llu %.8f\n",(long long)tp->aliceid,tp->bestprice);
}
else if ( now < tp - > firstprocessed + timeout & & ( ( tp - > firstprocessed - now ) % 1 0) = = 9 )
else if ( now < tp - > firstprocessed + timeout & & ( ( tp - > firstprocessed - now ) % 2 0) = = 1 9 )
{
//LP_Alicemaxprice = tp->bestprice;
//LP_reserved(ctx,LP_myipaddr,LP_mypubsock,&tp->Qs[LP_CONNECT]); // send LP_CONNECT
@ -1068,7 +1068,7 @@ void LP_tradesloop(void *ctx)
now = ( uint32_t ) time ( NULL ) ;
Q = qtp - > Q ;
funcid = qtp - > funcid ;
printf ( " dequeue %p funcid.%d aliceid.%llu iambob.%d \n " , qtp , funcid , ( long long ) qtp - > aliceid , qtp - > iambob ) ;
//printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp->aliceid,qtp->iambob);
portable_mutex_lock ( & LP_tradesmutex ) ;
DL_DELETE ( LP_tradesQ , qtp ) ;
HASH_FIND ( hh , LP_trades , & qtp - > aliceid , sizeof ( qtp - > aliceid ) , tp ) ;
@ -1093,7 +1093,7 @@ printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp
else if ( tp - > iambob = = 0 & & funcid = = LP_CONNECTED )
{
tp - > negotiationdone = now ;
printf ( " alice sets negotiationdone.%u \n " , now ) ;
//printf("alice sets negotiationdone.%u\n",now);
LP_trades_gotconnected ( ctx , & tp - > Q , & tp - > Qs [ LP_CONNECTED ] , tp - > pairstr ) ;
}
nonz + + ;
@ -1101,7 +1101,7 @@ printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp
if ( funcid = = LP_CONNECT & & tp - > negotiationdone = = 0 ) // bob all done
{
tp - > negotiationdone = now ;
printf ( " bob sets negotiationdone.%u \n " , now ) ;
//printf("bob sets negotiationdone.%u\n",now);
LP_trades_gotconnect ( ctx , & tp - > Q , & tp - > Qs [ LP_CONNECT ] , tp - > pairstr ) ;
}
}
@ -1111,7 +1111,7 @@ printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp
tp - > Q = qtp - > Q ;
if ( qtp - > iambob = = tp - > iambob & & qtp - > pairstr [ 0 ] ! = 0 )
safecopy ( tp - > pairstr , qtp - > pairstr , sizeof ( tp - > pairstr ) ) ;
printf ( " finished dequeue %p funcid.%d aliceid.%llu iambob.%d/%d done.%u \n " , qtp , funcid , ( long long ) qtp - > aliceid , qtp - > iambob , tp - > iambob , tp - > negotiationdone ) ;
//printf(" finished dequeue %p funcid.%d aliceid.%llu iambob.%d/%d done.%u\n",qtp,funcid,(long long)qtp->aliceid,qtp->iambob,tp->iambob,tp->negotiationdone);
free ( qtp ) ;
flag = 0 ;
if ( tp - > iambob = = 0 )
@ -1142,7 +1142,7 @@ printf("finished dequeue %p funcid.%d aliceid.%llu iambob.%d/%d done.%u\n",qtp,f
{
flag = 1 ;
tp - > negotiationdone = now ;
printf ( " bob sets negotiationdone.%u \n " , now ) ;
//printf("bob sets negotiationdone.%u\n",now);
LP_trades_gotconnect ( ctx , & tp - > Q , & tp - > Qs [ LP_CONNECT ] , tp - > pairstr ) ;
}
}