Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
df96e66ac2
  1. 17
      iguana/iguana_realtime.c
  2. 10
      iguana/iguana_volatiles.c
  3. 4
      iguana/main.c
  4. 1
      includes/iguana_funcs.h
  5. 2
      includes/iguana_structs.h

17
iguana/iguana_realtime.c

@ -468,6 +468,11 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
}
#endif
#undef uthash_malloc
#undef uthash_free
#define uthash_malloc(size) ((coin->RTHASHMEM.ptr == 0) ? mycalloc('u',1,size) : iguana_memalloc(&coin->RTHASHMEM,size,1))
#define uthash_free(mem,size) ((coin->RTHASHMEM.ptr == 0) ? myfree(mem,size) : 0)
struct iguana_RTaddr *iguana_RTaddrfind(struct iguana_info *coin,uint8_t *rmd160,char *coinaddr)
{
struct iguana_RTaddr *RTaddr; int32_t len; char _coinaddr[64];
@ -673,7 +678,7 @@ void iguana_RTtxid_free(struct iguana_RTtxid *RTptr)
void iguana_RTdataset_free(struct iguana_info *coin)
{
struct iguana_RTtxid *RTptr,*tmp; struct iguana_RTaddr *RTaddr,*tmp2; struct iguana_hhutxo *hhutxo,*tmphh;
struct iguana_RTtxid *RTptr,*tmp; struct iguana_RTaddr *RTaddr,*tmp2; struct iguana_hhutxo *hhutxo;
HASH_ITER(hh,coin->RTdataset,RTptr,tmp)
{
HASH_DELETE(hh,coin->RTdataset,RTptr);
@ -684,11 +689,8 @@ void iguana_RTdataset_free(struct iguana_info *coin)
HASH_DELETE(hh,coin->RTaddrs,RTaddr);
free(RTaddr);
}
HASH_ITER(hh,coin->utxotable,hhutxo,tmphh)
{
HASH_DELETE(hh,coin->utxotable,hhutxo);
free(hhutxo);
}
iguana_hhutxo_purge(coin);
iguana_memreset(&coin->RTHASHMEM);
}
struct iguana_RTtxid *iguana_RTtxid_create(struct iguana_info *coin,struct iguana_block *block,int64_t polarity,int32_t txi,int32_t txn_count,bits256 txid,int32_t numvouts,int32_t numvins,uint32_t locktime,uint32_t version,uint32_t timestamp)
@ -782,6 +784,9 @@ void iguana_RTreset(struct iguana_info *coin)
coin->lastRTheight = 0;
coin->RTheight = coin->firstRTheight;
iguana_RTdataset_free(coin);
if ( coin->RTHASHMEM.ptr == 0 )
iguana_meminit(&coin->RTHASHMEM,"RTHASHMEM",0,1024*1024*1024,0);
iguana_memreset(&coin->RTHASHMEM);
printf("%s RTreset %d\n",coin->symbol,coin->RTheight);
}

10
iguana/iguana_volatiles.c

@ -100,6 +100,16 @@ int32_t iguana_utxoupdate(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t
}
#endif
void iguana_hhutxo_purge(struct iguana_info *coin)
{
struct iguana_hhutxo *hhutxo,*tmp;
HASH_ITER(hh,coin->utxotable,hhutxo,tmp)
{
HASH_DELETE(hh,coin->utxotable,hhutxo);
free(hhutxo);
}
}
struct iguana_hhutxo *iguana_hhutxofind(struct iguana_info *coin,uint64_t uval)
{
struct iguana_hhutxo *hhutxo;

4
iguana/main.c

@ -553,10 +553,10 @@ void iguana_appletests(struct supernet_info *myinfo)
bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33);
printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
getchar();**/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
{
free(str);
if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"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 )

1
includes/iguana_funcs.h

@ -321,6 +321,7 @@ long iguana_spentsfile(struct iguana_info *coin,int32_t n);
uint8_t *iguana_rmdarray(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *numrmdsp,cJSON *array,int32_t firsti);
int64_t iguana_RTunspents(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *array,int32_t minconf,int32_t maxconf,uint8_t *rmdarray,int32_t numrmds,int32_t lastheight,struct iguana_outpoint *unspents,int32_t *numunspentsp,char *remoteaddr,int32_t includespent);
uint8_t *iguana_walletrmds(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *numrmdsp);
void iguana_hhutxo_purge(struct iguana_info *coin);
char *iguana_bundleaddrs(struct iguana_info *coin,int32_t hdrsi);
uint32_t iguana_sparseaddpk(uint8_t *bits,int32_t width,uint32_t tablesize,uint8_t rmd160[20],struct iguana_pkhash *P,uint32_t pkind,struct iguana_ramchain *ramchain);
int32_t iguana_vinscriptparse(struct iguana_info *coin,struct vin_info *vp,uint32_t *sigsizep,uint32_t *pubkeysizep,uint32_t *p2shsizep,uint32_t *suffixp,uint8_t *vinscript,int32_t scriptlen);

2
includes/iguana_structs.h

@ -454,7 +454,7 @@ struct iguana_info
int32_t disableUTXO,initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,firstRTheight,polltimeout,numreqtxids,allhashes,balanceflush,basilisk_busy; bits256 reqtxids[64];
void *launched,*started,*rpcloop;
uint64_t bloomsearches,bloomhits,bloomfalse,collisions,txfee_perkb,txfee;
uint8_t *blockspace; int32_t blockspacesize; struct OS_memspace blockMEM;
uint8_t *blockspace; int32_t blockspacesize; struct OS_memspace blockMEM,RTHASHMEM;
bits256 APIblockhash,APItxid; char *APIblockstr;
struct iguana_hhutxo *utxotable;
#ifdef DEPRECATED_HHUTXO

Loading…
Cancel
Save