Browse Source

test

etomic
jl777 8 years ago
parent
commit
3a76246e00
  1. 11
      iguana/kmd_lookup.h
  2. 2
      iguana/tests/dexgetsupply
  3. 2
      includes/iguana_structs.h

11
iguana/kmd_lookup.h

@ -330,10 +330,14 @@ cJSON *kmd_gettxin(struct iguana_info *coin,bits256 txid,int32_t vout)
cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode)
{
struct kmd_addresshh *addr; struct kmd_transactionhh *ptr,*spent,*prev=0; uint8_t type_rmd160[21]; int32_t i,height; cJSON *array = cJSON_CreateArray();
if ( (height= kmd_height(coin)) > coin->kmd_height+3 )
if ( time(NULL) > coin->kmd_lasttime+30 )
{
printf("height.%d > kmd_height.%d\n",height,coin->kmd_height);
return(cJSON_Parse("[]"));
coin->kmd_lasttime = (uint32_t)time(NULL);
if ( (height= kmd_height(coin)) > coin->kmd_height+3 )
{
printf("height.%d > kmd_height.%d\n",height,coin->kmd_height);
return(cJSON_Parse("[]"));
}
}
bitcoin_addr2rmd160(&type_rmd160[0],&type_rmd160[1],coinaddr);
if ( (addr= _kmd_address(coin,type_rmd160)) != 0 && (ptr= addr->prev) != 0 && ptr->tx != 0 )
@ -352,6 +356,7 @@ cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode)
prev = ptr->ptrs[i<<1];
}
}
printf("%s ht.%d prev.%p\n",coinaddr,ptr->tx->height,prev);
ptr = prev;
}
}

2
iguana/tests/dexgetsupply

@ -0,0 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"getbalance\",\"address\":\"*\",\"symbol\":\"KMD\"}"

2
includes/iguana_structs.h

@ -536,7 +536,7 @@ struct iguana_info
struct iguana_block *RTblocks[65536]; uint8_t *RTrawdata[65536]; int32_t RTrecvlens[65536],RTnumtx[65536];
struct iguana_RTtxid *RTdataset; struct iguana_RTaddr *RTaddrs;
struct hashstr_item *alladdresses;
struct kmd_transactionhh *kmd_transactions; struct kmd_addresshh *kmd_addresses; portable_mutex_t kmdmutex; FILE *kmd_txidfp; int32_t kmd_didinit,kmd_height;
struct kmd_transactionhh *kmd_transactions; struct kmd_addresshh *kmd_addresses; portable_mutex_t kmdmutex; FILE *kmd_txidfp; int32_t kmd_didinit,kmd_height; uint32_t kmd_lasttime;
};
struct vin_signer { bits256 privkey; char coinaddr[64]; uint8_t siglen,sig[80],rmd160[20],pubkey[66]; };

Loading…
Cancel
Save