Browse Source

Merge pull request #98 from artemii235/etomic

Additional logging in LP_iseligible.
pass-iguana-arg
Artem Pikulin 7 years ago
committed by GitHub
parent
commit
0166fbc387
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      iguana/exchanges/LP_signatures.c
  2. 27
      iguana/exchanges/LP_utxo.c

8
iguana/exchanges/LP_signatures.c

@ -128,25 +128,29 @@ int32_t LP_quoteparse(struct LP_quoteinfo *qp,cJSON *argjson)
safecopy(qp->gui,LP_gui,sizeof(qp->gui));
safecopy(qp->srccoin,jstr(argjson,"base"),sizeof(qp->srccoin));
safecopy(qp->uuidstr,jstr(argjson,"uuid"),sizeof(qp->uuidstr));
#ifndef NOTETOMIC
if ( LP_etomicsymbol(activesymbol,etomic,qp->srccoin) != 0 )
{
if ( (etomicstr= jstr(argjson,"bobtomic")) == 0 || strcmp(etomicstr,etomic) != 0 )
if ( (etomicstr= jstr(argjson,"bobtomic")) == 0 || compareAddresses(etomicstr,etomic) == 0 )
{
printf("etomic src mismatch (%s) vs (%s)\n",etomicstr!=0?etomicstr:"",etomic);
return(-1);
}
}
#endif
safecopy(qp->coinaddr,jstr(argjson,"address"),sizeof(qp->coinaddr));
safecopy(qp->etomicsrc,jstr(argjson,"etomicsrc"),sizeof(qp->etomicsrc));
safecopy(qp->destcoin,jstr(argjson,"rel"),sizeof(qp->destcoin));
#ifndef NOTETOMIC
if ( LP_etomicsymbol(activesymbol,etomic,qp->destcoin) != 0 )
{
if ( (etomicstr= jstr(argjson,"alicetomic")) == 0 || strcmp(etomicstr,etomic) != 0 )
if ( (etomicstr= jstr(argjson,"alicetomic")) == 0 || compareAddresses(etomicstr,etomic) == 0 )
{
printf("etomic dest mismatch (%s) vs (%s)\n",etomicstr!=0?etomicstr:"",etomic);
return(-1);
}
}
#endif
safecopy(qp->destaddr,jstr(argjson,"destaddr"),sizeof(qp->destaddr));
safecopy(qp->etomicdest,jstr(argjson,"etomicdest"),sizeof(qp->etomicdest));
qp->aliceid = j64bits(argjson,"aliceid");

27
iguana/exchanges/LP_utxo.c

@ -1217,16 +1217,27 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol
strcpy(destaddr,destaddr2);
if ( coin != 0 )
{
if ( (txobj= LP_gettxout(coin->symbol,destaddr,txid,vout)) == 0 )
return(0);
char txid_str[100], txid2_str[100];
bits256_str(txid_str, txid);
bits256_str(txid2_str, txid2);
if ( (txobj= LP_gettxout(coin->symbol,destaddr,txid,vout)) == 0 ) {
printf("Could not find tx out: %s %d\n", txid_str, vout);
return (0);
}
else free_json(txobj);
if ( (txobj= LP_gettxout(coin->symbol,destaddr,txid2,vout2)) == 0 )
return(0);
if ( (txobj= LP_gettxout(coin->symbol,destaddr,txid2,vout2)) == 0 ) {
printf("Could not find tx out: %s %d\n", txid_str, vout2);
return (0);
}
else free_json(txobj);
if ( LP_numconfirms(coin->symbol,destaddr,txid,vout,0) <= 0 )
return(0);
if ( LP_numconfirms(coin->symbol,destaddr,txid2,vout2,0) <= 0 )
return(0);
if ( LP_numconfirms(coin->symbol,destaddr,txid,vout,0) <= 0 ) {
printf("Txid numconfirms is less or equal to zero: %s %d\n", txid_str, vout);
return (0);
}
if ( LP_numconfirms(coin->symbol,destaddr,txid2,vout2,0) <= 0 ) {
printf("Txid numconfirms is less or equal to zero: %s %d\n", txid2_str, vout2);
return (0);
}
}
return(1);
}

Loading…
Cancel
Save