From 5c828964c7c184deeab5f772f9903b631bbc99b4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 May 2016 12:52:57 -0500 Subject: [PATCH] test --- iguana/iguana_msg.c | 6 +++--- iguana/iguana_txidfind.c | 2 +- iguana/iguana_unspents.c | 6 +++--- iguana/iguana_wallet.c | 10 +++++----- iguana/main.c | 2 +- iguana/tests/getreceivedbyaddress | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index a9769a58f..2c5a0b6b6 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -606,9 +606,9 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc } else if ( strcmp(H->command,"pangea") == 0 ) { - init_hexbytes_noT(addr->TXDATA.ptr,data,recvlen); - printf("pangea InstantDEX message\n"); - SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,addr->TXDATA.ptr,tai_now(),addr->ipaddr); + //init_hexbytes_noT(0,data,recvlen); + printf("skip pangea InstantDEX message\n"); + //SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,0,tai_now(),addr->ipaddr); return(0); } else if ( strcmp(H->command,"quote") == 0 ) diff --git a/iguana/iguana_txidfind.c b/iguana/iguana_txidfind.c index 0415f3bed..992e7a633 100755 --- a/iguana/iguana_txidfind.c +++ b/iguana/iguana_txidfind.c @@ -27,7 +27,7 @@ int32_t iguana_alloctxbits(struct iguana_info *coin,struct iguana_ramchain *ramc ramchain->txbits = calloc(1,tlen); memcpy(ramchain->txbits,TXbits,tlen); total += tlen; - char str[65]; printf("alloc.[%d] txbits.%p[%d] total %s\n",ramchain->H.data->height/coin->chain->bundlesize,ramchain->txbits,tlen,mbstr(str,total)); + char str[65]; printf("%s alloc.[%d] txbits.%p[%d] total %s\n",coin->symbol,ramchain->H.data->height/coin->chain->bundlesize,ramchain->txbits,tlen,mbstr(str,total)); return(tlen); } return(-1); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 32a2229e9..c89ed2b05 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -150,7 +150,7 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r *ramchainp = ramchain; *depositsp = ACCTS[pkind].total; *lastunspentindp = ACCTS[pkind].lastunspentind; - //printf("[%d] return pkind.%u of %u P.%p %.8f last.%u ACCTS.%p %p\n",i,pkind,numpkinds,P,dstr(*depositsp),*lastunspentindp,ACCTS,ramchain->A); + printf("[%d] return pkind.%u of %u P.%p %.8f last.%u ACCTS.%p %p\n",i,pkind,numpkinds,P,dstr(*depositsp),*lastunspentindp,ACCTS,ramchain->A); if ( P != 0 ) *p = P[pkind]; return(p); @@ -196,7 +196,7 @@ int64_t iguana_pkhashbalance(struct supernet_info *myinfo,struct iguana_info *co while ( unspentind > 0 ) { uheight = iguana_uheight(coin,ramchain->height,T,rdata->numtxids,&U[unspentind]); - if ( uheight < lastheight ) + if ( lastheight <= 0 || uheight < lastheight ) { deposits += U[unspentind].value; if ( lastheight < 0 || iguana_spentflag(coin,&RTspend,&spentheight,ramchain,hdrsi,unspentind,lastheight,minconf,maxconf,U[unspentind].value) == 0 ) @@ -270,7 +270,7 @@ int32_t iguana_pkhasharray(struct supernet_info *myinfo,struct iguana_info *coin } else { - //printf("pkhash balance.[%d] from m.%d check %.8f vs %.8f spent %.8f [%.8f]\n",i,m,dstr(netbalance),dstr(deposits),dstr(spent),dstr(deposits)-dstr(spent)); + printf("pkhash balance.[%d] from m.%d check %.8f vs %.8f spent %.8f [%.8f]\n",i,m,dstr(netbalance),dstr(deposits),dstr(spent),dstr(deposits)-dstr(spent)); total += netbalance; n++; } diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 6a7b228d4..94830ee3f 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -1417,8 +1417,8 @@ THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag) cJSON *retjson,*item,*array,*txids,*vouts; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2; if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); - if ( myinfo->expiration == 0 ) - return(clonestr("{\"error\":\"need to unlock wallet\"}")); + //if ( myinfo->expiration == 0 ) + // return(clonestr("{\"error\":\"need to unlock wallet\"}")); array = cJSON_CreateArray(); HASH_ITER(hh,myinfo->wallet,wacct,tmp) { @@ -1444,13 +1444,13 @@ STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf) char *balancestr; cJSON *balancejson,*retjson = cJSON_CreateObject(); if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); - if ( myinfo->expiration == 0 ) - return(clonestr("{\"error\":\"need to unlock wallet\"}")); + //if ( myinfo->expiration == 0 ) + // return(clonestr("{\"error\":\"need to unlock wallet\"}")); if ( (balancestr= iguana_balance(IGUANA_CALLARGS,coin->symbol,address,-1,minconf)) != 0 ) { if ( (balancejson= cJSON_Parse(balancestr)) != 0 ) { - jaddnum(retjson,"result",dstr(jdouble(balancejson,"balance"))); + jaddnum(retjson,"result",jdouble(balancejson,"balance")); free_json(balancejson); } } diff --git a/iguana/main.c b/iguana/main.c index 546dc7872..6bbd9696f 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1156,7 +1156,7 @@ void iguana_appletests(struct supernet_info *myinfo) if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) { free(str); - if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":1,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":1,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) { free(str); if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"login\",\"handle\":\"alice\",\"password\":\"alice\",\"passphrase\":\"alice\"}"),0,myinfo->rpcport)) != 0 ) diff --git a/iguana/tests/getreceivedbyaddress b/iguana/tests/getreceivedbyaddress index c7ebf41bf..6f652200a 100755 --- a/iguana/tests/getreceivedbyaddress +++ b/iguana/tests/getreceivedbyaddress @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"method\":\"getreceivedbyaddress\",\"params\":[\"$1\"]}" +curl --url "http://127.0.0.1:7778" --data "{\"method\":\"getreceivedbyaddress\",\"params\":[\"RL1tyXPK5NzT1d4upgcHnujgG5v3xjLaYC\"]}"