Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f74154e9ad
  1. 19
      iguana/iguana777.c
  2. 2
      iguana/iguana_recv.c
  3. 40
      iguana/iguana_unspents.c
  4. 207
      includes/iguana_apideclares.h

19
iguana/iguana777.c

@ -380,16 +380,19 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
return(-1);
if ( coin->PREFETCHLAG > 0 )
iguana_ramchain_prefetch(coin,&bp->ramchain,0);
if ( bp->utxofinish > 1 || (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag)) >= 0 )
if ( strcmp("BTC",coin->symbol) == 0 || iguana_bundlevalidate(coin,bp,0) == 0 )
{
//printf("spendvectors retval.%d\n",retval);
if ( retval > 0 )
if ( bp->utxofinish > 1 || (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag)) >= 0 )
{
//printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo);
num++;
}
bp->utxofinish = (uint32_t)time(NULL);
} else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi);
//printf("spendvectors retval.%d\n",retval);
if ( retval > 0 )
{
//printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo);
num++;
}
bp->utxofinish = (uint32_t)time(NULL);
} else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi);
}
}
while ( (n= iguana_utxofinished(coin)) < max )
{

2
iguana/iguana_recv.c

@ -753,7 +753,7 @@ void iguana_checklongestchain(struct iguana_info *coin,struct iguana_bundle *bp,
int32_t i; struct iguana_peer *addr;
if ( num > 3 && num < bp->n )
{
if ( coin->longestchain > bp->bundleheight+num+coin->chain->minconfirms )
if ( coin->longestchain > bp->bundleheight+num+10*coin->chain->minconfirms )
{
printf("strange.%d suspicious longestchain.%d vs [%d:%d] %d bp->n %d\n",coin->longestchain_strange,coin->longestchain,bp->hdrsi,num,bp->bundleheight+num,bp->n);
if ( coin->longestchain_strange++ > 10 )

40
iguana/iguana_unspents.c

@ -164,24 +164,28 @@ void iguana_volatilesalloc(struct iguana_info *coin,struct iguana_ramchain *ramc
void iguana_volatilespurge(struct iguana_info *coin,struct iguana_ramchain *ramchain)
{
if ( ramchain->allocatedA != 0 && ramchain->A != 0 )
free(ramchain->A);
ramchain->A = 0;
if ( ramchain->allocatedU != 0 && ramchain->Uextras != 0 )
free(ramchain->Uextras);
ramchain->Uextras = 0;
ramchain->allocatedA = ramchain->allocatedU = 0;
if ( ramchain->debitsfileptr != 0 )
{
munmap(ramchain->debitsfileptr,ramchain->debitsfilesize);
ramchain->debitsfileptr = 0;
ramchain->debitsfilesize = 0;
}
if ( ramchain->lastspendsfileptr != 0 )
{
munmap(ramchain->lastspendsfileptr,ramchain->lastspendsfilesize);
ramchain->lastspendsfileptr = 0;
ramchain->lastspendsfilesize = 0;
struct iguana_bundle *bp;
if ( (bp= coin->current) != 0 && ramchain->height < bp->bundleheight )
{
if ( ramchain->allocatedA != 0 && ramchain->A != 0 )
free(ramchain->A);
ramchain->A = 0;
if ( ramchain->allocatedU != 0 && ramchain->Uextras != 0 )
free(ramchain->Uextras);
ramchain->Uextras = 0;
ramchain->allocatedA = ramchain->allocatedU = 0;
if ( ramchain->debitsfileptr != 0 )
{
munmap(ramchain->debitsfileptr,ramchain->debitsfilesize);
ramchain->debitsfileptr = 0;
ramchain->debitsfilesize = 0;
}
if ( ramchain->lastspendsfileptr != 0 )
{
munmap(ramchain->lastspendsfileptr,ramchain->lastspendsfilesize);
ramchain->lastspendsfileptr = 0;
ramchain->lastspendsfilesize = 0;
}
}
}

207
includes/iguana_apideclares.h

@ -13,18 +13,6 @@
* *
******************************************************************************/
STRING_ARG(SuperNET,bitcoinrpc,setcoin);
STRING_ARG(SuperNET,myipaddr,ipaddr);
STRING_ARG(SuperNET,setmyipaddr,ipaddr);
TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,minaccept,base,rel,minprice,basevolume);
TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,maxaccept,base,rel,maxprice,basevolume);
P2SH_SPENDAPI(iguana,spendmsig,activecoin,vintxid,vinvout,destaddress,destamount,destaddress2,destamount2,M,N,pubA,wifA,pubB,wifB,pubC,wifC);
/*TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,BTCoffer,othercoin,otherassetid,maxprice,othervolume);
STRING_AND_TWO_DOUBLES(InstantDEX,ALToffer,basecoin,minprice,basevolume);
STRING_AND_TWO_DOUBLES(InstantDEX,NXToffer,assetid,minprice,basevolume);*/
STRING_AND_INT(iguana,bundleaddresses,activecoin,height);
STRING_AND_INT(iguana,bundlehashes,activecoin,height);
HASH_AND_STRING(bitcoinrpc,verifytx,txid,txbytes);
INT_ARG(bitcoinrpc,getblockhash,height);
@ -33,12 +21,93 @@ HASH_AND_INT(bitcoinrpc,getrawtransaction,txid,verbose);
HASH_ARG(bitcoinrpc,gettransaction,txid);
STRING_ARG(bitcoinrpc,decoderawtransaction,rawtx);
FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase);
ZERO_ARGS(SuperNET,logout);
ZERO_ARGS(SuperNET,activehandle);
THREE_STRINGS(SuperNET,encryptjson,password,permanentfile,anything);
TWO_STRINGS(SuperNET,decryptjson,password,permanentfile);
ZERO_ARGS(bitcoinrpc,getinfo);
ZERO_ARGS(bitcoinrpc,getbestblockhash);
ZERO_ARGS(bitcoinrpc,getblockcount);
ZERO_ARGS(bitcoinrpc,listaddressgroupings);
ZERO_ARGS(bitcoinrpc,makekeypair);
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo);
ZERO_ARGS(bitcoinrpc,listlockunspent);
ZERO_ARGS(bitcoinrpc,getrawchangeaddress);
TWO_INTS(bitcoinrpc,listaccounts,minconf,includewatchonly);
THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag);
TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array);
ZERO_ARGS(bitcoinrpc,walletlock);
ZERO_ARGS(bitcoinrpc,checkwallet);
ZERO_ARGS(bitcoinrpc,repairwallet);
STRING_ARG(bitcoinrpc,dumpwallet,filename);
STRING_ARG(bitcoinrpc,backupwallet,filename);
THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile);
FOUR_STRINGS(bitcoinrpc,walletpassphrasechange,oldpassword,newpassword,oldpermanentfile,permanentfile);
STRING_ARG(bitcoinrpc,importwallet,filename);
TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout);
STRING_ARG(bitcoinrpc,validateaddress,address);
STRING_ARG(bitcoinrpc,validatepubkey,pubkey);
STRING_ARG(bitcoinrpc,getnewaddress,account);
STRING_ARG(bitcoinrpc,vanitygen,vanity);
STRING_ARG(bitcoinrpc,getaddressesbyaccount,account);
STRING_ARG(bitcoinrpc,getaccount,address);
STRING_ARG(bitcoinrpc,getaccountaddress,account);
STRING_ARG(bitcoinrpc,dumpprivkey,address);
STRING_ARG(bitcoinrpc,decodescript,script);
TWO_STRINGS(bitcoinrpc,setaccount,address,account);
TWO_STRINGS(bitcoinrpc,signmessage,address,message);
THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message);
THREE_INTS(bitcoinrpc,listreceivedbyaccount,confirmations,includeempty,watchonly);
THREE_INTS(bitcoinrpc,getbalance,confirmations,includeempty,watchonly);
TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan);
STRING_AND_INT(bitcoinrpc,getreceivedbyaccount,account,includeempty);
STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf);
STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees);
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag);
STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly);
HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool);
DOUBLE_ARG(bitcoinrpc,settxfee,amount);
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array);
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,account);
TWO_ARRAYS(bitcoinrpc,createrawtransaction,vins,vouts);
STRING_AND_TWOARRAYS(bitcoinrpc,signrawtransaction,rawtx,vins,privkeys);
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment);
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2);
S_A_I_S(bitcoinrpc,sendmany,fromaccount,array,minconf,comment);
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2);
STRING_ARG(iguana,peers,activecoin);
STRING_AND_INT(iguana,maxpeers,activecoin,max);
STRING_ARG(iguana,getconnectioncount,activecoin);
STRING_ARG(iguana,addcoin,newcoin);
STRING_ARG(iguana,validate,activecoin);
STRING_ARG(iguana,removecoin,activecoin);
STRING_ARG(iguana,startcoin,activecoin);
STRING_ARG(iguana,pausecoin,activecoin);
STRING_ARG(iguana,stopcoin,activecoin);
TWO_STRINGS(iguana,addnode,activecoin,ipaddr);
TWO_STRINGS(iguana,persistent,activecoin,ipaddr);
TWO_STRINGS(iguana,removenode,activecoin,ipaddr);
TWO_STRINGS(iguana,oneshot,activecoin,ipaddr);
TWO_STRINGS(iguana,nodestatus,activecoin,ipaddr);
TWOSTRINGS_AND_INT(iguana,balance,activecoin,address,height);
P2SH_SPENDAPI(iguana,spendmsig,activecoin,vintxid,vinvout,destaddress,destamount,destaddress2,destamount2,M,N,pubA,wifA,pubB,wifB,pubC,wifC);
STRING_AND_INT(iguana,bundleaddresses,activecoin,height);
STRING_AND_INT(iguana,bundlehashes,activecoin,height);
TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,minaccept,base,rel,minprice,basevolume);
TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,maxaccept,base,rel,maxprice,basevolume);
THREE_STRINGS_AND_THREE_INTS(InstantDEX,orderbook,exchange,base,rel,depth,allfields,ignore);
THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,buy,exchange,base,rel,price,volume,dotrade);
THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,sell,exchange,base,rel,price,volume,dotrade);
@ -93,6 +162,22 @@ HASH_ARG(pangea,start,tablehash);
ZERO_ARGS(SuperNET,help);
STRING_ARG(SuperNET,utime2utc,utime);
INT_ARG(SuperNET,utc2utime,utc);
STRING_ARG(SuperNET,getpeers,activecoin);
TWO_ARRAYS(SuperNET,mypeers,supernet,rawpeers);
ZERO_ARGS(SuperNET,stop);
HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr);
HASH_ARRAY_STRING(SuperNET,layer,mypriv,otherpubs,str);
STRING_ARG(SuperNET,bitcoinrpc,setcoin);
STRING_ARG(SuperNET,myipaddr,ipaddr);
STRING_ARG(SuperNET,setmyipaddr,ipaddr);
FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase);
ZERO_ARGS(SuperNET,logout);
ZERO_ARGS(SuperNET,activehandle);
THREE_STRINGS(SuperNET,encryptjson,password,permanentfile,anything);
TWO_STRINGS(SuperNET,decryptjson,password,permanentfile);
TWO_STRINGS(SuperNET,html,agentform,htmlfile);
TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(SuperNET,DHT,hexmsg,destip,categoryhash,subhash,maxdelay,broadcast);
@ -126,94 +211,6 @@ STRING_ARG(mouse,close,name);
STRING_ARG(mouse,leave,name);
STRING_AND_INT(keyboard,key,name,c);
STRING_ARG(SuperNET,getpeers,activecoin);
TWO_ARRAYS(SuperNET,mypeers,supernet,rawpeers);
ZERO_ARGS(SuperNET,stop);
HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr);
HASH_ARRAY_STRING(SuperNET,layer,mypriv,otherpubs,str);
STRING_ARG(iguana,peers,activecoin);
STRING_AND_INT(iguana,maxpeers,activecoin,max);
STRING_ARG(iguana,getconnectioncount,activecoin);
STRING_ARG(iguana,addcoin,newcoin);
STRING_ARG(iguana,validate,activecoin);
STRING_ARG(iguana,removecoin,activecoin);
STRING_ARG(iguana,startcoin,activecoin);
STRING_ARG(iguana,pausecoin,activecoin);
STRING_ARG(iguana,stopcoin,activecoin);
TWO_STRINGS(iguana,addnode,activecoin,ipaddr);
TWO_STRINGS(iguana,persistent,activecoin,ipaddr);
TWO_STRINGS(iguana,removenode,activecoin,ipaddr);
TWO_STRINGS(iguana,oneshot,activecoin,ipaddr);
TWO_STRINGS(iguana,nodestatus,activecoin,ipaddr);
TWOSTRINGS_AND_INT(iguana,balance,activecoin,address,height);
ZERO_ARGS(bitcoinrpc,getinfo);
ZERO_ARGS(bitcoinrpc,getbestblockhash);
ZERO_ARGS(bitcoinrpc,getblockcount);
ZERO_ARGS(bitcoinrpc,listaddressgroupings);
ZERO_ARGS(bitcoinrpc,makekeypair);
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo);
ZERO_ARGS(bitcoinrpc,listlockunspent);
ZERO_ARGS(bitcoinrpc,getrawchangeaddress);
TWO_INTS(bitcoinrpc,listaccounts,minconf,includewatchonly);
THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag);
TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array);
ZERO_ARGS(bitcoinrpc,walletlock);
ZERO_ARGS(bitcoinrpc,checkwallet);
ZERO_ARGS(bitcoinrpc,repairwallet);
STRING_ARG(bitcoinrpc,dumpwallet,filename);
STRING_ARG(bitcoinrpc,backupwallet,filename);
THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile);
FOUR_STRINGS(bitcoinrpc,walletpassphrasechange,oldpassword,newpassword,oldpermanentfile,permanentfile);
STRING_ARG(bitcoinrpc,importwallet,filename);
TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout);
STRING_ARG(bitcoinrpc,validateaddress,address);
STRING_ARG(bitcoinrpc,validatepubkey,pubkey);
STRING_ARG(bitcoinrpc,getnewaddress,account);
STRING_ARG(bitcoinrpc,vanitygen,vanity);
STRING_ARG(bitcoinrpc,getaddressesbyaccount,account);
STRING_ARG(bitcoinrpc,getaccount,address);
STRING_ARG(bitcoinrpc,getaccountaddress,account);
STRING_ARG(bitcoinrpc,dumpprivkey,address);
STRING_ARG(bitcoinrpc,decodescript,script);
TWO_STRINGS(bitcoinrpc,setaccount,address,account);
TWO_STRINGS(bitcoinrpc,signmessage,address,message);
THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message);
THREE_INTS(bitcoinrpc,listreceivedbyaccount,confirmations,includeempty,watchonly);
THREE_INTS(bitcoinrpc,getbalance,confirmations,includeempty,watchonly);
TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan);
STRING_AND_INT(bitcoinrpc,getreceivedbyaccount,account,includeempty);
STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf);
STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees);
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag);
STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly);
HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool);
DOUBLE_ARG(bitcoinrpc,settxfee,amount);
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array);
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,account);
TWO_ARRAYS(bitcoinrpc,createrawtransaction,vins,vouts);
STRING_AND_TWOARRAYS(bitcoinrpc,signrawtransaction,rawtx,vins,privkeys);
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment);
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2);
S_A_I_S(bitcoinrpc,sendmany,fromaccount,array,minconf,comment);
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2);
STRING_ARG(hash,hex,message);
STRING_ARG(hash,unhex,hexmsg);
TWO_HASHES(hash,curve25519_pair,element,scalar);

Loading…
Cancel
Save