From 61d48edc8b5bd711a9935ad22eb95ad8e761e18d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 11 Nov 2017 00:24:03 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_ordermatch.c | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 9cd07e134..17dc752ef 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -649,7 +649,7 @@ int32_t LP_validSPV(char *symbol,char *coinaddr,bits256 txid,int32_t vout) backupep = ep; up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); if ( up->SPV <= 0 ) - return(up->SPV); + return(-1); } } return(0); @@ -666,30 +666,20 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, LP_tradecommand_log(argjson); //printf("LP_tradecommand: check received method %s aliceid.%llx\n",method,(long long)Q.aliceid); retval = 1; - if ( LP_validSPV(Q.destcoin,Q.destaddr,Q.desttxid,Q.destvout) < 0 ) - { - printf("%s dest %s failed SPV check\n",Q.destcoin,bits256_str(str,Q.desttxid)); - return(retval); - } - else if (LP_validSPV(Q.destcoin,Q.destaddr,Q.feetxid,Q.feevout) < 0 ) - { - printf("%s dexfee %s failed SPV check\n",Q.destcoin,bits256_str(str,Q.feetxid)); - return(retval); - } if ( strcmp(method,"reserved") == 0 ) { - if ( LP_validSPV(Q.srccoin,Q.coinaddr,Q.txid,Q.vout) < 0 ) - { - printf("%s src %s failed SPV check\n",Q.srccoin,bits256_str(str,Q.txid)); - return(retval); - } - else if (LP_validSPV(Q.srccoin,Q.coinaddr,Q.txid2,Q.vout2) < 0 ) - { - printf("%s src2 %s failed SPV check\n",Q.srccoin,bits256_str(str,Q.txid2)); - return(retval); - } if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 && LP_alice_eligible() > 0 ) { + if ( LP_validSPV(Q.srccoin,Q.coinaddr,Q.txid,Q.vout) < 0 ) + { + printf("%s src %s failed SPV check\n",Q.srccoin,bits256_str(str,Q.txid)); + return(retval); + } + else if (LP_validSPV(Q.srccoin,Q.coinaddr,Q.txid2,Q.vout2) < 0 ) + { + printf("%s src2 %s failed SPV check\n",Q.srccoin,bits256_str(str,Q.txid2)); + return(retval); + } LP_aliceid(Q.tradeid,Q.aliceid,"reserved",0,0); printf("alice %s received RESERVED.(%s)\n",bits256_str(str,G.LP_mypub25519),jprint(argjson,0)); if ( (retstr= LP_quotereceived(argjson)) != 0 ) @@ -725,6 +715,16 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, printf("this node has no price for %s/%s\n",Q.srccoin,Q.destcoin); return(retval); } + if ( LP_validSPV(Q.destcoin,Q.destaddr,Q.desttxid,Q.destvout) < 0 ) + { + printf("%s dest %s failed SPV check\n",Q.destcoin,bits256_str(str,Q.desttxid)); + return(retval); + } + else if (LP_validSPV(Q.destcoin,Q.destaddr,Q.feetxid,Q.feevout) < 0 ) + { + printf("%s dexfee %s failed SPV check\n",Q.destcoin,bits256_str(str,Q.feetxid)); + return(retval); + } price = ask; /*if ( coin->electrum != 0 ) {