Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
5c828964c7
  1. 6
      iguana/iguana_msg.c
  2. 2
      iguana/iguana_txidfind.c
  3. 6
      iguana/iguana_unspents.c
  4. 10
      iguana/iguana_wallet.c
  5. 2
      iguana/main.c
  6. 2
      iguana/tests/getreceivedbyaddress

6
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 ) else if ( strcmp(H->command,"pangea") == 0 )
{ {
init_hexbytes_noT(addr->TXDATA.ptr,data,recvlen); //init_hexbytes_noT(0,data,recvlen);
printf("pangea InstantDEX message\n"); printf("skip pangea InstantDEX message\n");
SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,addr->TXDATA.ptr,tai_now(),addr->ipaddr); //SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,0,tai_now(),addr->ipaddr);
return(0); return(0);
} }
else if ( strcmp(H->command,"quote") == 0 ) else if ( strcmp(H->command,"quote") == 0 )

2
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); ramchain->txbits = calloc(1,tlen);
memcpy(ramchain->txbits,TXbits,tlen); memcpy(ramchain->txbits,TXbits,tlen);
total += 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(tlen);
} }
return(-1); return(-1);

6
iguana/iguana_unspents.c

@ -150,7 +150,7 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r
*ramchainp = ramchain; *ramchainp = ramchain;
*depositsp = ACCTS[pkind].total; *depositsp = ACCTS[pkind].total;
*lastunspentindp = ACCTS[pkind].lastunspentind; *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 ) if ( P != 0 )
*p = P[pkind]; *p = P[pkind];
return(p); return(p);
@ -196,7 +196,7 @@ int64_t iguana_pkhashbalance(struct supernet_info *myinfo,struct iguana_info *co
while ( unspentind > 0 ) while ( unspentind > 0 )
{ {
uheight = iguana_uheight(coin,ramchain->height,T,rdata->numtxids,&U[unspentind]); uheight = iguana_uheight(coin,ramchain->height,T,rdata->numtxids,&U[unspentind]);
if ( uheight < lastheight ) if ( lastheight <= 0 || uheight < lastheight )
{ {
deposits += U[unspentind].value; deposits += U[unspentind].value;
if ( lastheight < 0 || iguana_spentflag(coin,&RTspend,&spentheight,ramchain,hdrsi,unspentind,lastheight,minconf,maxconf,U[unspentind].value) == 0 ) 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 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; total += netbalance;
n++; n++;
} }

10
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; cJSON *retjson,*item,*array,*txids,*vouts; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 ) //if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}")); // return(clonestr("{\"error\":\"need to unlock wallet\"}"));
array = cJSON_CreateArray(); array = cJSON_CreateArray();
HASH_ITER(hh,myinfo->wallet,wacct,tmp) 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(); char *balancestr; cJSON *balancejson,*retjson = cJSON_CreateObject();
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 ) //if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}")); // return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( (balancestr= iguana_balance(IGUANA_CALLARGS,coin->symbol,address,-1,minconf)) != 0 ) if ( (balancestr= iguana_balance(IGUANA_CALLARGS,coin->symbol,address,-1,minconf)) != 0 )
{ {
if ( (balancejson= cJSON_Parse(balancestr)) != 0 ) if ( (balancejson= cJSON_Parse(balancestr)) != 0 )
{ {
jaddnum(retjson,"result",dstr(jdouble(balancejson,"balance"))); jaddnum(retjson,"result",jdouble(balancejson,"balance"));
free_json(balancejson); free_json(balancejson);
} }
} }

2
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 ) 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); 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); free(str);
if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"login\",\"handle\":\"alice\",\"password\":\"alice\",\"passphrase\":\"alice\"}"),0,myinfo->rpcport)) != 0 ) if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"login\",\"handle\":\"alice\",\"password\":\"alice\",\"passphrase\":\"alice\"}"),0,myinfo->rpcport)) != 0 )

2
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\"]}"

Loading…
Cancel
Save