Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
29e33cefeb
  1. 4
      basilisk/basilisk_bitcoin.c
  2. 2
      basilisk/basilisk_swap.c
  3. 4
      gecko/gecko_blocks.c
  4. 2
      gecko/gecko_mempool.c
  5. 3
      iguana/coins/dgb
  6. 0
      iguana/coins/eac
  7. 3
      iguana/coins/gendgb
  8. 0
      iguana/coins/geneac
  9. 22
      iguana/confs/DGB_peers.txt
  10. 3
      iguana/confs/DOGE_peers.txt
  11. 14
      iguana/confs/EAC_peers.txt
  12. 2
      iguana/exchanges/bitcoin.c
  13. 2
      iguana/iguana_accept.c
  14. 3
      iguana/iguana_init.c
  15. 69
      iguana/iguana_payments.c
  16. 20
      iguana/iguana_realtime.c
  17. 37
      iguana/iguana_recv.c
  18. 4
      iguana/iguana_sign.c
  19. 3
      iguana/iguana_spendvectors.c
  20. 2
      iguana/iguana_txidfind.c
  21. 75
      iguana/iguana_unspents.c
  22. 20
      iguana/iguana_wallet.c
  23. 12
      iguana/ramchain_api.c
  24. 2
      iguana/swaps/iguana_BTCswap.c
  25. 21
      includes/iguana_funcs.h

4
basilisk/basilisk_bitcoin.c

@ -379,7 +379,7 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi
{
if ( (coin->VALIDATENODE != 0 || coin->RELAYNODE != 0) )//&& coinaddr != 0 && coinaddr[0] != 0 )
{
if ( iguana_unspentindfind(myinfo,coin,coinaddr,0,0,&value,&height,txid,vout,coin->bundlescount,0) > 0 )
if ( iguana_RTunspentindfind(myinfo,coin,coinaddr,0,0,&value,&height,txid,vout,coin->bundlescount,0) > 0 )
{
//printf("bitcoinvalue found iguana\n");
Lptr->retstr = basilisk_valuestr(coin,coinaddr,value,height,txid,vout);
@ -1163,7 +1163,7 @@ void basilisk_unspents_update(struct supernet_info *myinfo,struct iguana_info *c
portable_mutex_lock(&myinfo->bu_mutex);
if ( (retarray= cJSON_Parse(retstr)) != 0 )
{
//printf("%s UNSPENTS_UPDATE.(%s)\n",coin->symbol,retstr);
printf("%s UNSPENTS_UPDATE.(%s)\n",coin->symbol,retstr);
if ( jobj(retarray,"error") == 0 )
{
if ( (jstr(retarray,"ipaddr") == 0 || strcmp(jstr(retarray,"ipaddr"),myinfo->ipaddr) != 0) && (n= cJSON_GetArraySize(retarray)) > 0 )

2
basilisk/basilisk_swap.c

@ -550,7 +550,7 @@ int32_t basilisk_rawtx_return(struct supernet_info *myinfo,int32_t height,struct
{
if ( lockinputs != 0 )
{
iguana_unspentslock(myinfo,rawtx->coin,vins);
iguana_RTunspentslock(myinfo,rawtx->coin,vins);
if ( (n= cJSON_GetArraySize(vins)) != 0 )
{
bits256 txid; int32_t vout;

4
gecko/gecko_blocks.c

@ -158,8 +158,8 @@ int32_t gecko_hwmset(struct supernet_info *myinfo,struct iguana_info *virt,struc
if ( bp->blocks[i] != 0 && bp->blocks[i]->txvalid != 0 )
bp->numsaved++;
virt->current = bp;
iguana_RTspendvectors(myinfo,virt,bp);
iguana_RTramchainalloc("RTbundle",virt,bp);
//iguana_RTspendvectors(myinfo,virt,bp);
//iguana_RTramchainalloc("RTbundle",virt,bp);
printf("update virtchain balances\n");
//iguana_update_balances(virt);
//iguana_realtime_update(myinfo,virt);

2
gecko/gecko_mempool.c

@ -237,7 +237,7 @@ char *gecko_txarrived(struct supernet_info *myinfo,struct iguana_info *virt,char
{
for (i=0; i<numvins; i++)
{
if ( (unspentind= iguana_unspentindfind(myinfo,virt,0,0,0,&value,&spentheight,msg.vins[i].prev_hash,msg.vins[i].prev_vout,virt->bundlescount-1,1)) != 0 )
if ( (unspentind= iguana_RTunspentindfind(myinfo,virt,0,0,0,&value,&spentheight,msg.vins[i].prev_hash,msg.vins[i].prev_vout,virt->bundlescount-1,1)) != 0 )
{
hdrsi = spentheight / virt->chain->bundlesize;
hdrsi_unspentind = ((uint64_t)hdrsi << 32) | unspentind;

3
iguana/coins/dgb

@ -0,0 +1,3 @@
curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DGB\",\"name\":\"Digibyte\",\"netmagic\":\"FAC3B6DA\",\"p2p\":12024,\"rpc\":14022,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496\",\"genesis\":{\"version\":1,\"timestamp\":1389388394,\"nBits\":\"1e0ffff0\",\"nonce\":2447652,\"merkle_root\":\"72ddd9496b004221ed0557358846d9248ecd4c440ebd28ed901efc18757d0fad\"},\"alertpubkey\":\"04F04441C4757F356290A37C313C3772C5BC5003E898EB2E0CF365795543A7BF690C8BBBFA32EE3A3325477CE2000B7D0453EFBB203329D0F9DF34D5927D022BC9\"}"

0
iguana/coins/earth → iguana/coins/eac

3
iguana/coins/gendgb

@ -0,0 +1,3 @@
curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DGB\",\"name\":\"Digibyte\",\"netmagic\":\"FAC3B6DA\",\"p2p\":12024,\"rpc\":14022,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496\",\"genesis\":{\"version\":1,\"timestamp\":1389388394,\"nBits\":\"1e0ffff0\",\"nonce\":2447652,\"merkle_root\":\"72ddd9496b004221ed0557358846d9248ecd4c440ebd28ed901efc18757d0fad\"},\"alertpubkey\":\"04F04441C4757F356290A37C313C3772C5BC5003E898EB2E0CF365795543A7BF690C8BBBFA32EE3A3325477CE2000B7D0453EFBB203329D0F9DF34D5927D022BC9\"}"

0
iguana/coins/genearth → iguana/coins/geneac

22
iguana/confs/DGB_peers.txt

@ -0,0 +1,22 @@
216.250.125.121
69.164.198.161
45.79.10.59
66.228.56.115
178.33.228.14
85.201.209.80
157.161.128.58
190.36.237.121
167.160.36.126
104.236.32.184
212.107.130.19
95.93.101.100
108.61.10.90
212.129.1.77
74.208.230.160
31.220.25.91
184.155.218.183
24.119.23.61
70.196.193.231
198.98.118.241
142.4.204.115

3
iguana/confs/DOGE_peers.txt

@ -0,0 +1,3 @@
198.84.182.253
50.167.159.50
50.168.159.133

14
iguana/confs/EAC_peers.txt

@ -0,0 +1,14 @@
151.80.206.105
123.56.194.66
146.0.32.101
178.33.209.212
182.92.183.58
95.83.11.226
69.165.199.54
192.190.90.252
123.211.4.17
24.197.135.210
46.101.170.250
82.246.238.240
188.218.135.19
74.56.186.129

2
iguana/exchanges/bitcoin.c

@ -457,7 +457,7 @@ cJSON *BALANCES(struct exchange_info *exchange,cJSON *argjson)
minconfirms = coin->minconfirms;
max = 100000;
unspents = calloc(max,sizeof(*unspents));
if ( (numunspents= iguana_unspentslists(myinfo,coin,&avail,unspents,max,((uint64_t)1 << 62),minconfirms,addresses,0)) > 0 )
if ( (numunspents= iguana_RTunspentslists(myinfo,coin,&avail,unspents,max,((uint64_t)1 << 62),minconfirms,addresses,0)) > 0 )
{
array = cJSON_CreateArray();
for (i=0; i<numunspents; i++)

2
iguana/iguana_accept.c

@ -306,7 +306,7 @@ int32_t iguana_headerget(struct iguana_info *coin,uint8_t *serialized,int32_t ma
int32_t iguana_peerhdrrequest(struct supernet_info *myinfo,struct iguana_info *coin,uint8_t *serialized,int32_t maxsize,struct iguana_peer *addr,bits256 hash2)
{
int32_t len=0,i,flag=0,height,n,hdrsi,bundlei,bundlesize,firstvout,retval=-1; struct iguana_block *block; struct iguana_bundle *bp;
if ( (firstvout= iguana_unspentindfind(myinfo,coin,0,0,0,0,&height,hash2,0,coin->bundlescount-1,0)) != 0 )
if ( (firstvout= iguana_RTunspentindfind(myinfo,coin,0,0,0,0,&height,hash2,0,coin->bundlescount-1,0)) != 0 )
{
bundlesize = coin->chain->bundlesize;
hdrsi = (height / bundlesize);

3
iguana/iguana_init.c

@ -476,7 +476,8 @@ void iguana_coinpurge(struct iguana_info *coin)
myfree(req,req->allocsize);
}
}
iguana_RTramchainfree(coin,coin->current);
//iguana_RTramchainfree(coin,coin->current);
iguana_RTdataset_free(coin);
coin->bundlescount = 0;
for (i=0; i<coin->bundlescount; i++)
if ( (bp= coin->bundles[i]) != 0 )

69
iguana/iguana_payments.c

@ -162,7 +162,7 @@ cJSON *iguana_scriptobj(struct iguana_info *coin,uint8_t rmd160[20],char *coinad
return(scriptobj);
}
int32_t iguana_bestunspent(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *belowp,int64_t *unspents,int32_t numunspents,uint64_t value)
int32_t iguana_RTbestunspent(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *belowp,int64_t *unspents,int32_t numunspents,uint64_t value)
{
int32_t i,abovei,belowi; int64_t above,below,gap,atx_value;
abovei = belowi = -1;
@ -170,7 +170,7 @@ int32_t iguana_bestunspent(struct supernet_info *myinfo,struct iguana_info *coin
{
if ( (atx_value= unspents[(i << 1) + 1]) <= 0 )
continue;
if ( iguana_unspent_check(myinfo,coin,(uint16_t)(unspents[i << 1] >> 32),(uint32_t)unspents[i << 1]) != 0 )
if ( iguana_RTunspent_check(myinfo,coin,(uint16_t)(unspents[i << 1] >> 32),(uint32_t)unspents[i << 1]) != 0 )
{
printf("(%d u%d) %.8f already used\n",(uint16_t)(unspents[i << 1] >> 32),(uint32_t)unspents[i << 1],dstr(atx_value));
continue;
@ -216,7 +216,7 @@ cJSON *iguana_inputjson(bits256 txid,int32_t vout,uint8_t *spendscript,int32_t s
return(item);
}
cJSON *iguana_inputsjson(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,uint64_t amount,int64_t *unspents,int32_t num)
cJSON *iguana_RTinputsjson(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,uint64_t amount,int64_t *unspents,int32_t num)
{
cJSON *vins; uint8_t spendscript[IGUANA_MAXSCRIPTSIZE]; struct iguana_txid *T; struct iguana_unspent *U,*u; struct iguana_bundle *bp; struct iguana_ramchain *ramchain; char coinaddr[64]; int32_t vout,height,abovei,belowi,i,spendlen,ind,hdrsi; uint32_t txidind,unspentind; struct iguana_ramchaindata *rdata; bits256 txid; int64_t value,above,below,total = 0; int64_t remains = amount;
*totalp = 0;
@ -224,7 +224,7 @@ cJSON *iguana_inputsjson(struct supernet_info *myinfo,struct iguana_info *coin,i
for (i=0; i<num; i++)
{
below = above = 0;
if ( iguana_bestunspent(myinfo,coin,&abovei,&above,&belowi,&below,unspents,num,remains) < 0 )
if ( iguana_RTbestunspent(myinfo,coin,&abovei,&above,&belowi,&below,unspents,num,remains) < 0 )
{
printf("error finding unspent i.%d of %d, %.8f vs %.8f\n",i,num,dstr(remains),dstr(amount));
free_json(vins);
@ -250,6 +250,16 @@ cJSON *iguana_inputsjson(struct supernet_info *myinfo,struct iguana_info *coin,i
}
continue;
}
if ( (spendlen= iguana_RTunspentfind(myinfo,coin,&txid,&vout,spendscript,hdrsi,unspentind,value)) > 0 )
{
jaddi(vins,iguana_inputjson(txid,vout,spendscript,spendlen));
total += value;
remains -= value;
//printf("%s value %.8f -> remains %.8f\n",coinaddr,dstr(value),dstr(remains));
if ( remains <= 0 )
break;
continue;
}
if ( (bp= coin->bundles[hdrsi]) == 0 )
{
printf("no bundle.[%d]\n",hdrsi);
@ -361,14 +371,14 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS
max = 10000;
satoshis += burnamount;
unspents = calloc(max,sizeof(*unspents));
if ( (num= iguana_unspentslists(myinfo,coin,&avail,unspents,max,satoshis+txfee,minconf,addresses,remoteaddr)) <= 0 )
if ( (num= iguana_RTunspentslists(myinfo,coin,&avail,unspents,max,satoshis+txfee,minconf,addresses,remoteaddr)) <= 0 )
{
free(unspents);
return(0);
}
if ( txobj != 0 && avail >= satoshis+txfee )
{
if ( (vins= iguana_inputsjson(myinfo,coin,&total,satoshis + txfee,unspents,num)) != 0 )
if ( (vins= iguana_RTinputsjson(myinfo,coin,&total,satoshis + txfee,unspents,num)) != 0 )
{
if ( total < (satoshis + txfee) )
{
@ -420,7 +430,7 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS
return(rawtx);
}
void iguana_unspentslock(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins)
void iguana_RTunspentslock(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins)
{
uint32_t spent_unspentind; char coinaddr[64]; int16_t spent_hdrsi; int32_t i,RTspentflag,num;
if ( coin->MAXPEERS == 1 || coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 )
@ -428,8 +438,8 @@ void iguana_unspentslock(struct supernet_info *myinfo,struct iguana_info *coin,c
num = cJSON_GetArraySize(vins);
for (i=0; i<num; i++)
{
if ( iguana_inputaddress(myinfo,coin,coinaddr,&spent_hdrsi,&spent_unspentind,jitem(vins,i)) != 0 )
iguana_utxofind(coin,spent_hdrsi,spent_unspentind,&RTspentflag,1);
if ( iguana_RTinputaddress(myinfo,coin,coinaddr,&spent_hdrsi,&spent_unspentind,jitem(vins,i)) != 0 )
iguana_RTutxofind(coin,spent_hdrsi,spent_unspentind,&RTspentflag,1);
}
}
}
@ -476,7 +486,7 @@ char *sendtoaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *
{
if ( (signedtx= iguana_signrawtx(myinfo,coin,coin->blocks.hwmchain.height,&signedtxid,&completed,vins,rawtx,0,0)) != 0 )
{
iguana_unspentslock(myinfo,coin,vins);
iguana_RTunspentslock(myinfo,coin,vins);
retjson = cJSON_CreateObject();
jaddbits256(retjson,"result",signedtxid);
jaddstr(retjson,"signedtx",signedtx);
@ -669,11 +679,26 @@ INT_ARRAY_STRING(bitcoinrpc,addmultisigaddress,M,pubkeys,account) //
HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool)
{
uint8_t script[IGUANA_MAXSCRIPTSIZE],rmd160[20],pubkey33[33]; char coinaddr[128],asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; struct iguana_bundle *bp; int32_t minconf,scriptlen,unspentind,height,spentheight; int64_t RTspend; struct iguana_ramchaindata *rdata; struct iguana_pkhash *P; struct iguana_txid *T; struct iguana_unspent *U; struct iguana_ramchain *ramchain; cJSON *scriptobj,*retjson = cJSON_CreateObject();
uint8_t script[IGUANA_MAXSCRIPTSIZE],rmd160[20],pubkey33[33]; char coinaddr[128],asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; struct iguana_bundle *bp; int32_t minconf,scriptlen,unspentind,height,spentheight; int64_t RTspend; int64_t value; struct iguana_ramchaindata *rdata; struct iguana_pkhash *P; struct iguana_txid *T; struct iguana_unspent *U; struct iguana_ramchain *ramchain; cJSON *scriptobj,*retjson = cJSON_CreateObject();
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( coin != 0 )
{
if ( (value= RTgettxout(coin,&height,&scriptlen,script,rmd160,coinaddr,txid,vout,mempool)) > 0 )
{
jaddbits256(retjson,"bestblock",coin->blocks.hwmchain.RO.hash2);
jaddnum(retjson,"bestheight",coin->blocks.hwmchain.height);
jaddnum(retjson,"height",height);
jaddnum(retjson,"confirmations",coin->blocks.hwmchain.height - height + 1);
jaddnum(retjson,"value",dstr(value));
if ( (height % coin->chain->bundlesize) == 0 && vout == 0 )
jadd(retjson,"coinbase",jtrue());
else jadd(retjson,"coinbase",jfalse());
asmstr[0] = 0;
if ( (scriptobj= iguana_scriptobj(coin,rmd160,coinaddr,asmstr,script,scriptlen)) != 0 )
jadd(retjson,"scriptPubKey",scriptobj);
return(jprint(retjson,1));
}
minconf = (mempool != 0) ? 0 : 1;
if ( (unspentind= iguana_unspentindfind(myinfo,coin,0,0,0,0,&height,txid,vout,coin->bundlescount-1,0)) != 0 )
{
@ -927,7 +952,7 @@ char *iguana_validaterawtx(struct supernet_info *myinfo,struct iguana_info *coin
for (i=0; i<numinputs; i++)
{
len += iguana_parsevinobj(myinfo,coin,&serialized[len],maxsize-len,&vin,jitem(vins,i),&V[i]);
if ( (V[i].unspentind= iguana_unspentindfind(myinfo,coin,V[i].coinaddr,V[i].spendscript,&V[i].spendlen,&V[i].amount,&V[i].height,msgtx->vins[i].prev_hash,msgtx->vins[i].prev_vout,coin->bundlescount-1,mempool)) > 0 )
if ( (V[i].unspentind= iguana_RTunspentindfind(myinfo,coin,V[i].coinaddr,V[i].spendscript,&V[i].spendlen,&V[i].amount,&V[i].height,msgtx->vins[i].prev_hash,msgtx->vins[i].prev_vout,coin->bundlescount-1,mempool)) > 0 )
{
inputsum += V[i].amount;
msgtx->vins[i].spendscript = V[i].spendscript;
@ -1044,7 +1069,7 @@ cJSON *iguana_createvins(struct supernet_info *myinfo,struct iguana_info *coin,c
spendlen = (int32_t)strlen(hexstr) >> 1;
decode_hex(spendscript,spendlen,hexstr);
}
if ( (unspentind= iguana_unspentindfind(myinfo,coin,coinaddr,spendscript,&spendlen,&satoshis,&height,txid,vout,coin->bundlescount-1,0)) > 0 )
if ( (unspentind= iguana_RTunspentindfind(myinfo,coin,coinaddr,spendscript,&spendlen,&satoshis,&height,txid,vout,coin->bundlescount-1,0)) > 0 )
{
//printf("[%d] unspentind.%d (%s) spendlen.%d %.8f\n",height/coin->chain->bundlesize,unspentind,coinaddr,spendlen,dstr(satoshis));
if ( coinaddr[0] != 0 && (waddr= iguana_waddresssearch(myinfo,&wacct,coinaddr)) != 0 )
@ -1167,17 +1192,19 @@ ARRAY_OBJ_INT(bitcoinrpc,createrawtransaction,vins,vouts,locktime)
TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array)
{
int32_t numrmds,numunspents=0; uint8_t *rmdarray; cJSON *retjson = cJSON_CreateArray();
//int32_t numrmds,numunspents=0; uint8_t *rmdarray; cJSON *retjson = cJSON_CreateArray();
cJSON *argarray,*retjson;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( minconf == 0 )
minconf = 1;
if ( maxconf == 0 )
maxconf = (1 << 30);
rmdarray = iguana_rmdarray(myinfo,coin,&numrmds,array,0);
iguana_unspents(myinfo,coin,retjson,minconf,maxconf,rmdarray,numrmds,(1 << 30),0,&numunspents,remoteaddr);
if ( rmdarray != 0 )
free(rmdarray);
if ( (argarray= array) == 0 || cJSON_GetArraySize(array) == 0 )
argarray = iguana_getaddressesbyaccount(myinfo,coin,"*");
retjson = iguana_RTlistunspent(myinfo,coin,argarray,minconf,maxconf,remoteaddr);
if ( argarray != array )
free_json(argarray);
return(jprint(retjson,1));
}
@ -1205,10 +1232,10 @@ INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array)
{
txid = jbits256(item,"txid");
vout = jint(item,"vout");
if ( (unspentind= iguana_unspentindfind(myinfo,coin,0,0,0,0,&height,txid,vout,coin->bundlescount-1,0)) != 0 )
if ( (unspentind= iguana_RTunspentindfind(myinfo,coin,0,0,0,0,&height,txid,vout,coin->bundlescount-1,0)) != 0 )
{
hdrsi = height / coin->chain->bundlesize;
iguana_utxofind(coin,hdrsi,unspentind,&RTspendflag,!flag);
iguana_RTutxofind(coin,hdrsi,unspentind,&RTspendflag,!flag);
}
}
}
@ -1230,7 +1257,7 @@ ZERO_ARGS(bitcoinrpc,listlockunspent)
item = cJSON_CreateObject();
hdrsi = (int32_t)(hhutxo->uval >> 32);
unspentind = (uint32_t)hhutxo->uval;
if ( (vout= iguana_uvaltxid(myinfo,&txid,coin,hdrsi,unspentind)) >= 0 )
if ( (vout= iguana_RTuvaltxid(myinfo,&txid,coin,hdrsi,unspentind)) >= 0 )
{
jaddbits256(item,"txid",txid);
jaddnum(item,"vout",vout);

20
iguana/iguana_realtime.c

@ -16,6 +16,7 @@
#include "iguana777.h"
//#define ENABLE_RAMCHAIN
#ifdef oldway
void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp)
{
//return;
@ -463,6 +464,21 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
#endif
return(flag);
}
#endif
int64_t iguana_RTbalance(struct iguana_info *coin,char *coinaddr)
{
struct iguana_RTaddr *RTaddr; uint8_t addrtype,rmd160[20]; int32_t len;
len = (int32_t)strlen(coinaddr);
HASH_FIND(hh,coin->RTaddrs,coinaddr,len,RTaddr);
if ( RTaddr != 0 )
return(RTaddr->credits - RTaddr->debits + RTaddr->histbalance);
else
{
bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr);
return(iguana_utxoaddrtablefind(coin,-1,-1,rmd160));
}
}
void iguana_RTcoinaddr(struct iguana_info *coin,struct iguana_RTtxid *RTptr,struct iguana_block *block,int64_t polarity,char *coinaddr,uint8_t *rmd160,int32_t spendflag,int64_t value,struct iguana_RTunspent *unspent)
{
@ -476,10 +492,14 @@ void iguana_RTcoinaddr(struct iguana_info *coin,struct iguana_RTtxid *RTptr,stru
HASH_ADD_KEYPTR(hh,coin->RTaddrs,RTaddr->coinaddr,len,RTaddr);
}
if ( spendflag != 0 )
{
RTaddr->debits += polarity * value;
coin->RTdebits += polarity * value;
}
else
{
RTaddr->credits += polarity * value;
coin->RTcredits += polarity * value;
if ( polarity > 0 )
{
printf("unspent[%d] <- %p\n",RTaddr->numunspents,unspent);

37
iguana/iguana_recv.c

@ -517,7 +517,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i
for (i=0; i<coin->bundlescount; i++)
if ( (bp= coin->bundles[i]) != 0 && bp->utxofinish <= 1 )
break;
if ( i > coin->bundlescount-2 && coin->blocks.hwmchain.height > coin->longestchain-coin->chain->bundlesize )
if ( i > coin->bundlescount-2 && coin->blocks.hwmchain.height > coin->longestchain-coin->chain->bundlesize*2 )
{
portable_mutex_lock(&coin->RTmutex);
iguana_RTrawdata(coin,txdata->zblock.RO.hash2,data,&recvlen,&numtx,0);
@ -536,7 +536,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i
req->addr = addr;
//if ( (bits256_cmp(origtxdata->zblock.RO.hash2,coin->blocks.hwmchain.RO.hash2) == 0 || req->zblock.mainchain == 0 || req->zblock.valid == 0 || req->zblock.txvalid == 0) && iguana_RTrawdata(coin,origtxdata->zblock.RO.hash2,0,&len,&numtx,1) == 0 )
queue_enqueue("recvQ",&coin->recvQ,&req->DL,0);
//else printf("skipQ.(%s)\n",bits256_str(str,origtxdata->zblock.RO.hash2));
printf("Q.(%s)\n",bits256_str(str,origtxdata->zblock.RO.hash2));
} else printf("nonz fpos.%d %s\n",txdata->zblock.fpos,bits256_str(str,origtxdata->zblock.RO.hash2));
}
@ -1225,7 +1225,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
struct iguana_bundlereq *iguana_recvblock(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,struct iguana_bundlereq *req,struct iguana_zblock *origblock,int32_t numtx,int32_t datalen,int32_t recvlen,int32_t *newhwmp)
{
struct iguana_bundle *bp=0,*prev; int32_t n,bundlei = -2; struct iguana_block *block,*next,*prevblock; char str[65]; bits256 hash2;
//printf("%s received.(%s) %s\n",coin->symbol,bits256_str(str,origblock->RO.hash2),addr->ipaddr);
printf("%s received.(%s) %s\n",coin->symbol,bits256_str(str,origblock->RO.hash2),addr->ipaddr);
if ( (block= iguana_blockfind("recv",coin,origblock->RO.hash2)) != 0 )
iguana_blockcopy(coin->chain->zcash,coin->chain->auxpow,coin,block,(struct iguana_block *)origblock);
else if ( (block= iguana_blockhashset("recvblock",coin,-1,origblock->RO.hash2,1)) == 0 )
@ -1853,34 +1853,15 @@ int32_t iguana_processrecv(struct supernet_info *myinfo,struct iguana_info *coin
}
flag += iguana_processrecvQ(myinfo,coin,&newhwm);
flag += iguana_reqblocks(myinfo,coin);
//if ( coin->spendvectorsaved > 1 )
if ( time(NULL) > coin->laststats+5 )
{
if ( time(NULL) > coin->laststats+5 )
{
flag += iguana_reqhdrs(coin);
iguana_bundlestats(myinfo,coin,str,IGUANA_DEFAULTLAG);
coin->laststats = (uint32_t)time(NULL);
}
flag += iguana_reqhdrs(coin);
iguana_bundlestats(myinfo,coin,str,IGUANA_DEFAULTLAG);
coin->laststats = (uint32_t)time(NULL);
}
/*else
{
flag += iguana_reqblocks(coin);
iguana_bundlestats(coin,str,IGUANA_DEFAULTLAG);
}
if ( time(NULL) > coin->spendvectorsaved )
{
for (i=0; i<coin->chain->bundlesize; i++)
{
if ( coin->RTdatabad != 0 || iguana_realtime_update(myinfo,coin) <= 0 )
break;
}
}*/
iguana_realtime_update(myinfo,coin);
coin->RTramchain_busy = 0;//(coin->RTgenesis == 0);
//iguana_realtime_update(myinfo,coin);
coin->RTramchain_busy = 0;
flag += iguana_process_msgrequestQ(myinfo,coin);
//if ( strcmp("BTCD",coin->symbol) == 0 )
// instantdex_update(SuperNET_MYINFO(0));
if ( hwmheight != coin->blocks.hwmchain.height )
flag = 1;
return(flag);

4
iguana/iguana_sign.c

@ -218,7 +218,7 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
{
if ( vin->vinscript == 0 )
{
if ( (V->unspentind= iguana_unspentindfind(myinfo,coin,V->coinaddr,V->spendscript,&V->spendlen,&V->amount,&V->height,vin->prev_hash,vin->prev_vout,coin->bundlescount-1,0)) > 0 )
if ( (V->unspentind= iguana_RTunspentindfind(myinfo,coin,V->coinaddr,V->spendscript,&V->spendlen,&V->amount,&V->height,vin->prev_hash,vin->prev_vout,coin->bundlescount-1,0)) > 0 )
{
if ( V->coinaddr[0] != 0 && (waddr= iguana_waddresssearch(myinfo,&wacct,V->coinaddr)) != 0 )
{
@ -899,7 +899,7 @@ int32_t iguana_vininfo_create(struct supernet_info *myinfo,struct iguana_info *c
finalized = 0;
if ( msgtx->vins[i].spendscript == 0 )
{
if ( (vp->unspentind= iguana_unspentindfind(myinfo,coin,vp->coinaddr,vp->spendscript,&vp->spendlen,&vp->amount,&vp->height,msgtx->vins[i].prev_hash,msgtx->vins[i].prev_vout,coin->bundlescount-1,0)) > 0 )
if ( (vp->unspentind= iguana_RTunspentindfind(myinfo,coin,vp->coinaddr,vp->spendscript,&vp->spendlen,&vp->amount,&vp->height,msgtx->vins[i].prev_hash,msgtx->vins[i].prev_vout,coin->bundlescount-1,0)) > 0 )
{
msgtx->vins[i].spendscript = vp->spendscript;
msgtx->vins[i].spendlen = vp->spendlen;

3
iguana/iguana_spendvectors.c

@ -962,7 +962,8 @@ int32_t iguana_balanceflush(struct supernet_info *myinfo,struct iguana_info *coi
}
coin->balanceswritten = iguana_volatilesinit(myinfo,coin);
//printf("flush free\n");
iguana_RTramchainfree(coin,bp);
iguana_RTdataset_free(coin);
//iguana_RTramchainfree(coin,bp);
return(coin->balanceswritten);
}

2
iguana/iguana_txidfind.c

@ -656,7 +656,7 @@ double iguana_txidstatus(struct supernet_info *myinfo,struct iguana_info *coin,b
int32_t height,firstvout,numranked; struct iguana_monitorinfo *ptr; char str[65];
if ( coin != 0 && coin->peers != 0 && (numranked= coin->peers->numranked) > 0 )
{
if ( (firstvout= iguana_unspentindfind(myinfo,coin,0,0,0,0,&height,txid,0,coin->bundlescount-1,0)) != 0 )
if ( (firstvout= iguana_RTunspentindfind(myinfo,coin,0,0,0,0,&height,txid,0,coin->bundlescount-1,0)) != 0 )
{
if ( (ptr= iguana_monitorfind(coin,txid)) != 0 )
memset(ptr,0,sizeof(*ptr));

75
iguana/iguana_unspents.c

@ -148,7 +148,7 @@ int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *c
return(unspentind);
}
char *iguana_inputaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int16_t *spent_hdrsip,uint32_t *unspentindp,cJSON *vinobj)
char *iguana_RTinputaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int16_t *spent_hdrsip,uint32_t *unspentindp,cJSON *vinobj)
{
bits256 txid; int32_t vout,checkind,height;
*unspentindp = 0;
@ -159,7 +159,7 @@ char *iguana_inputaddress(struct supernet_info *myinfo,struct iguana_info *coin,
vout = jint(vinobj,"vout");
height = jint(vinobj,"height");
checkind = jint(vinobj,"checkind");
if ( (height != 0 && checkind != 0) || (checkind= iguana_unspentindfind(myinfo,coin,coinaddr,0,0,0,&height,txid,vout,coin->bundlescount-1,0)) > 0 )
if ( (height != 0 && checkind != 0) || (checkind= iguana_RTunspentindfind(myinfo,coin,coinaddr,0,0,0,&height,txid,vout,coin->bundlescount-1,0)) > 0 )
{
*spent_hdrsip = (height / coin->chain->bundlesize);
*unspentindp = checkind;
@ -860,6 +860,77 @@ int64_t iguana_unspentavail(struct supernet_info *myinfo,struct iguana_info *coi
else return(0);
}
int32_t iguana_RTunspent_check(struct supernet_info *myinfo,struct iguana_info *coin,uint16_t hdrsi,uint32_t unspentind)
{
// check RT
return(iguana_unspent_check(myinfo,coin,hdrsi,unspentind));
}
int32_t iguana_RTuvaltxid(struct supernet_info *myinfo,bits256 *txidp,struct iguana_info *coin,int16_t hdrsi,uint32_t unspentind)
{
//check RT
return(iguana_uvaltxid(myinfo,txidp,coin,hdrsi,unspentind));
}
int32_t iguana_RTunspentindfind(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,uint8_t *spendscript,int32_t *spendlenp,uint64_t *valuep,int32_t *heightp,bits256 txid,int32_t vout,int32_t lasthdrsi,int32_t mempool)
{
// check RT
return(iguana_unspentindfind(myinfo,coin,coinaddr,spendscript,spendlenp,valuep,heightp,txid,vout,lasthdrsi,mempool));
}
int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,int64_t *unspents,int32_t max,int64_t required,int32_t minconf,cJSON *addresses,char *remoteaddr)
{
// check RTlists
return(iguana_unspentslists(myinfo,coin,totalp,unspents,max,required,minconf,addresses,remoteaddr));
}
cJSON *iguana_RTlistunspent(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *argarray,int32_t minconf,int32_t maxconf,char *remoteaddr)
{
int32_t numrmds,numunspents=0; uint8_t *rmdarray; cJSON *item,*retjson = cJSON_CreateArray();
rmdarray = iguana_rmdarray(myinfo,coin,&numrmds,argarray,0);
iguana_unspents(myinfo,coin,retjson,minconf,maxconf,rmdarray,numrmds,(1 << 30),0,&numunspents,remoteaddr);
if ( rmdarray != 0 )
free(rmdarray);
/*{
"txid" : "d54994ece1d11b19785c7248868696250ab195605b469632b7bd68130e880c9a",
"vout" : 1,
"address" : "mgnucj8nYqdrPFh2JfZSB1NmUThUGnmsqe",
"account" : "test label",
"scriptPubKey" : "76a9140dfc8bafc8419853b34d5e072ad37d1a5159f58488ac",
"amount" : 0.00010000,
"confirmations" : 6210,
"spendable" : true
},*/
return(retjson);
}
int64_t RTgettxout(struct iguana_info *coin,int32_t *height,int32_t *scriptlen,uint8_t *script,uint8_t *rmd160,char *coinaddr,bits256 txid,int32_t vout,int32_t mempool)
{
int64_t value = 0;
// RT only
return(value);
}
int32_t iguana_RTunspentfind(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,uint8_t *spendscript,uint16_t hdrsi,uint32_t unspentind,int64_t value)
{
int32_t spendlen = 0;
// only RT
return(spendlen);
}
struct iguana_utxo iguana_RTutxofind(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t spent_unspentind,int32_t *RTspendflagp,int32_t lockflag)
{
// check RT
return(iguana_RTutxofind(coin,spent_hdrsi,spent_unspentind,RTspendflagp,lockflag));
}
int32_t iguana_RTspentflag(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *RTspendp,int32_t *spentheightp,struct iguana_ramchain *ramchain,int16_t spent_hdrsi,uint32_t spent_unspentind,int32_t height,int32_t minconf,int32_t maxconf,uint64_t amount)
{
// check RT
return(iguana_spentflag(myinfo,coin,RTspendp,spentheightp,ramchain,spent_hdrsi,spent_unspentind,height,minconf,maxconf,amount));
}
#define UTXOADDR_ITEMSIZE 32
#define iguana_utxotable_numinds(ind) (((ind) == 0xffff) ? coin->utxoaddrlastcount : (coin->utxoaddroffsets[(ind) + 1] - coin->utxoaddroffsets[ind]))

20
iguana/iguana_wallet.c

@ -281,7 +281,7 @@ cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_i
struct iguana_waccount *subset,*tmp; char coinaddr[64]; struct iguana_waddress *waddr,*tmp2; cJSON *retjson,*array;
retjson = cJSON_CreateObject();
array = cJSON_CreateArray();
if ( account == 0 )
if ( account == 0 || account[0] == 0 )
account = "*";
if ( strcmp("*",account) != 0 )
{
@ -890,6 +890,22 @@ int64_t iguana_waccountbalance(struct supernet_info *myinfo,struct iguana_info *
return(balance);
}
int64_t oldiguana_waccountbalance(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_waccount *wacct,int32_t minconf,int32_t lastheight)
{
int64_t balance=0; int32_t i,n; cJSON *addrs=0;
if ( minconf == 0 )
minconf = 1;
if ( (addrs= iguana_getaddressesbyaccount(myinfo,coin,wacct->account)) != 0 )
{
if ( (n= cJSON_GetArraySize(addrs)) > 0 )
{
for (i=0; i<n; i++)
balance += iguana_RTbalance(coin,jstri(addrs,i));
}
}
return(balance);
}
cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins)
{
int32_t i,j,n,numinputs; uint32_t spent_unspentind; int16_t spent_hdrsi; struct iguana_waddress *waddr; struct iguana_waccount *wacct; char *addresses,*address,coinaddr[64]; cJSON *privkeys = cJSON_CreateArray();
@ -898,7 +914,7 @@ cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin
addresses = calloc(numinputs,64);
for (i=n=0; i<numinputs; i++)
{
if ( (address= iguana_inputaddress(myinfo,coin,coinaddr,&spent_hdrsi,&spent_unspentind,jitem(vins,i))) != 0 )
if ( (address= iguana_RTinputaddress(myinfo,coin,coinaddr,&spent_hdrsi,&spent_unspentind,jitem(vins,i))) != 0 )
{
for (j=0; j<n; j++)
{

12
iguana/ramchain_api.c

@ -27,8 +27,9 @@ STRING_ARG(iguana,initfastfind,activecoin)
TWO_STRINGS_AND_TWO_DOUBLES(iguana,balance,activecoin,address,lastheightd,minconfd)
{
int32_t lastheight,minconf,maxconf=SATOSHIDEN; int64_t total=0; uint8_t rmd160[20],pubkey33[33],addrtype;
struct iguana_pkhash *P; cJSON *array,*retjson = cJSON_CreateObject();
//int32_t lastheight,minconf,maxconf=SATOSHIDEN; int64_t total=0; uint8_t rmd160[20],pubkey33[33],addrtype;
//struct iguana_pkhash *P;
int32_t minconf,lastheight; cJSON *retjson = cJSON_CreateObject();
if ( activecoin != 0 && activecoin[0] != 0 )
coin = iguana_coinfind(activecoin);
if ( coin != 0 )
@ -42,7 +43,8 @@ TWO_STRINGS_AND_TWO_DOUBLES(iguana,balance,activecoin,address,lastheightd,mincon
jaddstr(retjson,"error","illegal address");
return(jprint(retjson,1));
}
if ( bitcoin_addr2rmd160(&addrtype,rmd160,address) < 0 )
jaddnum(retjson,"balance",iguana_RTbalance(coin,address));
/*if ( bitcoin_addr2rmd160(&addrtype,rmd160,address) < 0 )
{
jaddstr(retjson,"error","cant convert address");
return(jprint(retjson,1));
@ -56,9 +58,9 @@ TWO_STRINGS_AND_TWO_DOUBLES(iguana,balance,activecoin,address,lastheightd,mincon
iguana_pkhasharray(myinfo,coin,array,minconf,maxconf,&total,P,coin->bundlescount,rmd160,address,pubkey33,lastheight,0,0,0,remoteaddr);
free(P);
jadd(retjson,"unspents",array);
jaddnum(retjson,"balance",dstr(total));
jaddnum(retjson,"balance",dstr(total));*/
if ( lastheight > 0 )
jaddnum(retjson,"lastheight",lastheight);
jaddnum(retjson,"RTheight",coin->RTheight);
}
return(jprint(retjson,1));
}

2
iguana/swaps/iguana_BTCswap.c

@ -216,7 +216,7 @@ struct bitcoin_statetx *instantdex_signtx(char *str,struct supernet_info *myinfo
//printf("vins.(%s)\n",jprint(vins,0));
if ( (signedtx= iguana_signrawtx(myinfo,coin,&signedtxid,&completed,vins,rawtx,privkey)) != 0 )
{
iguana_unspentslock(myinfo,coin,vins);
iguana_RTunspentslock(myinfo,coin,vins);
tx = calloc(1,sizeof(*tx) + strlen(signedtx) + 1);
strcpy(tx->txbytes,signedtx);
tx->txid = signedtxid;

21
includes/iguana_funcs.h

@ -354,8 +354,9 @@ void iguana_blocksetcounters(struct iguana_info *coin,struct iguana_block *block
int32_t iguana_ramchain_iterate(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *ramchain,struct iguana_bundle *bp,int16_t bundlei);
void *iguana_bundlefile(struct iguana_info *coin,char *fname,long *filesizep,struct iguana_bundle *bp,int32_t bundlei);
int32_t iguana_mapchaininit(char *fname,struct iguana_info *coin,struct iguana_ramchain *mapchain,struct iguana_bundle *bp,int32_t bundlei,struct iguana_block *block,void *ptr,long filesize);
void iguana_RTdataset_free(struct iguana_info *coin);
void iguana_autoextend(struct iguana_info *coin,struct iguana_bundle *bp);
void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp);
//void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp);
void iguana_coinpurge(struct iguana_info *coin);
int32_t iguana_setmaxbundles(struct iguana_info *coin);
void iguana_bundlepurgefiles(struct iguana_info *coin,struct iguana_bundle *bp);
@ -407,16 +408,21 @@ int32_t iguana_send_ping(struct supernet_info *myinfo,struct iguana_info *coin,s
int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_info *coin);
uint32_t iguana_fastfindinit(struct iguana_info *coin);
int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,uint8_t *spendscript,int32_t *scriptlenp,uint64_t *valuep,int32_t *heightp,bits256 txid,int32_t vout,int32_t lasthdrsi,int32_t mempool);
int32_t iguana_RTunspentindfind(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,uint8_t *spendscript,int32_t *scriptlenp,uint64_t *valuep,int32_t *heightp,bits256 txid,int32_t vout,int32_t lasthdrsi,int32_t mempool);
int32_t iguana_addressvalidate(struct iguana_info *coin,uint8_t *addrtypep,char *address);
int32_t bitcoin_sign(void *ctx,char *symbol,uint8_t *sig,bits256 txhash2,bits256 privkey,int32_t recoverflag);
bits256 iguana_str2priv(struct supernet_info *myinfo,struct iguana_info *coin,char *str);
int32_t iguana_spentflag(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *RTspendp,int32_t *spentheightp,struct iguana_ramchain *ramchain,int16_t spent_hdrsi,uint32_t spent_unspentind,int32_t height,int32_t minconf,int32_t maxconf,uint64_t amount);
int32_t iguana_RTspentflag(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *RTspendp,int32_t *spentheightp,struct iguana_ramchain *ramchain,int16_t spent_hdrsi,uint32_t spent_unspentind,int32_t height,int32_t minconf,int32_t maxconf,uint64_t amount);
int32_t iguana_voutscript(struct iguana_info *coin,struct iguana_bundle *bp,uint8_t *scriptspace,char *asmstr,struct iguana_unspent *u,struct iguana_pkhash *p,int32_t txi);
cJSON *iguana_unspentjson(struct supernet_info *myinfo,struct iguana_info *coin,int32_t hdrsi,uint32_t unspentind,struct iguana_txid *T,struct iguana_unspent *up,uint8_t rmd160[20],char *coinaddr,uint8_t *pubkey33,int32_t spentheight,char *remoteaddr);
int32_t bitcoin_standardspend(uint8_t *script,int32_t n,uint8_t rmd160[20]);
struct iguana_waddress *iguana_waddresssearch(struct supernet_info *myinfo,struct iguana_waccount **wacctp,char *coinaddr);
cJSON *iguana_RTlistunspent(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *argarray,int32_t minconf,int32_t maxconf,char *remoteaddr);
void calc_shares(struct supernet_info *myinfo,uint8_t *shares,uint8_t *secret,int32_t size,int32_t width,int32_t M,int32_t N,uint8_t *sharenrs,uint8_t *space,int32_t spacesize);
struct basilisk_spend *basilisk_addspend(struct supernet_info *myinfo,char *symbol,bits256 txid,uint16_t vout,int32_t addflag);
int64_t RTgettxout(struct iguana_info *coin,int32_t *height,int32_t *scriptlen,uint8_t *script,uint8_t *rmd160,char *coinaddr,bits256 txid,int32_t vout,int32_t mempool);
int32_t iguana_RTunspentfind(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,uint8_t *spendscript,uint16_t hdrsi,uint32_t unspentind,int64_t value);
int32_t basilisk_unspentfind(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,uint8_t *spendscript,int16_t hdrsi,uint32_t unspentind,int64_t value);
int64_t iguana_addressreceived(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,cJSON *txids,cJSON *vouts,cJSON *unspents,cJSON *spends,char *coinaddr,int32_t minconf,int32_t firstheight);
cJSON *iguana_walletjson(struct supernet_info *myinfo);
@ -434,7 +440,7 @@ int32_t bitcoin_validaddress(struct iguana_info *coin,char *coinaddr);
int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struct iguana_ramchain *spentchain,int16_t spent_hdrsi,uint32_t spent_unspentind,uint32_t spent_pkind,uint64_t spent_value,uint32_t spendind,uint32_t fromheight);
void iguana_utxoaddrs_purge(struct iguana_info *coin);
int32_t iguana_utxoupdate(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t spent_unspentind,uint32_t spent_pkind,uint64_t spent_value,uint32_t spendind,uint32_t fromheight,uint8_t *rmd160);
int32_t iguana_unspentslists(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,int64_t *unspents,int32_t max,int64_t required,int32_t minconf,cJSON *addresses,char *remoteaddr);
int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info *coin,int64_t *totalp,int64_t *unspents,int32_t max,int64_t required,int32_t minconf,cJSON *addresses,char *remoteaddr);
int64_t iguana_unspentset(struct supernet_info *myinfo,struct iguana_info *coin);
int32_t iguana_txidfastfind(struct iguana_info *coin,int32_t *heightp,bits256 txid,int32_t lasthdrsi);
uint8_t iguana_addrtype(struct iguana_info *coin,uint8_t script_type);
@ -446,12 +452,12 @@ int32_t bitcoin_recoververify(void *ctx,char *symbol,uint8_t *sig64,bits256 mess
int32_t bitcoin_assembler(struct iguana_info *coin,cJSON *logarray,uint8_t script[IGUANA_MAXSCRIPTSIZE],cJSON *scriptobj,int32_t interpret,int64_t nLockTime,struct vin_info *V);
cJSON *iguana_spendasm(struct iguana_info *coin,uint8_t *spendscript,int32_t spendlen);
int64_t iguana_unspentavail(struct supernet_info *myinfo,struct iguana_info *coin,uint64_t hdrsi_unspendind,int32_t minconf,int32_t maxconf);
struct iguana_utxo iguana_utxofind(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t spent_unspentind,int32_t *RTspendflagp,int32_t lockflag);
struct iguana_utxo iguana_RTutxofind(struct iguana_info *coin,int16_t spent_hdrsi,uint32_t spent_unspentind,int32_t *RTspendflagp,int32_t lockflag);
int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height,struct iguana_msgtx *msgtx,char **signedtxp,bits256 *signedtxidp,struct vin_info *V,int32_t numinputs,char *rawtx,cJSON *vins,cJSON *privkeys);
cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins);
char *iguana_inputaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int16_t *spent_hdrsip,uint32_t *unspentindp,cJSON *vinobj);
char *iguana_RTinputaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int16_t *spent_hdrsip,uint32_t *unspentindp,cJSON *vinobj);
struct iguana_waddress *iguana_getaccountaddress(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,char *coinaddr,char *account);
int32_t iguana_uvaltxid(struct supernet_info *myinfo,bits256 *txidp,struct iguana_info *coin,int16_t hdrsi,uint32_t unspentind);
int32_t iguana_RTuvaltxid(struct supernet_info *myinfo,bits256 *txidp,struct iguana_info *coin,int16_t hdrsi,uint32_t unspentind);
struct instantdex_accept *instantdex_quotefind(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,bits256 encodedhash);
int32_t instantdex_quoterequest(struct supernet_info *myinfo,struct iguana_info *coin,uint8_t *serialized,int32_t maxlen,struct iguana_peer *addr,bits256 encodedhash);
int32_t instantdex_peerhas_clear(struct iguana_info *coin,struct iguana_peer *addr);
@ -471,13 +477,13 @@ int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin);
struct iguana_bundlereq *iguana_bundlereq(struct iguana_info *coin,struct iguana_peer *addr,int32_t type,uint8_t *data,int32_t datalen);
void instantdex_FSMinit();
int32_t bitcoin_p2shspend(uint8_t *script,int32_t n,uint8_t rmd160[20]);
void iguana_unspentslock(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins);
void iguana_RTunspentslock(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins);
char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t satoshis,char *changeaddr,int64_t txfee,cJSON *addresses,int32_t minconf,uint8_t *opreturn,int32_t oplen,int64_t burnamount,char *remoteaddr);
int64_t datachain_update(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,uint8_t rmd160[20],int64_t crypto777_payment,uint8_t type,int32_t height,uint64_t hdrsi_unspentind,int64_t burned,uint32_t fileid,uint64_t scriptpos,int32_t scriptlen,bits256 txid,int32_t vout);
void datachain_update_spend(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,int32_t height,bits256 txid,int32_t vout,uint8_t rmd160[20],int64_t value);
cJSON *bitcoin_data2json(struct iguana_info *coin,int32_t height,bits256 *txidp,struct iguana_msgtx *msgtx,uint8_t *extraspace,int32_t extralen,uint8_t *serialized,int32_t len,cJSON *vins,int32_t suppress_pubkeys);
int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *spentheightp,bits256 *txidp,int32_t *voutp,int16_t hdrsi,uint32_t unspentind);
int32_t iguana_unspent_check(struct supernet_info *myinfo,struct iguana_info *coin,uint16_t hdrsi,uint32_t unspentind);
int32_t iguana_RTunspent_check(struct supernet_info *myinfo,struct iguana_info *coin,uint16_t hdrsi,uint32_t unspentind);
char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *valsobj);
char *iguana_signrawtx(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height,bits256 *signedtxidp,int32_t *completedp,cJSON *vins,char *rawtx,cJSON *privkey,struct vin_info *V);
@ -553,6 +559,7 @@ int32_t iguana_bundlehash2_check(struct iguana_info *coin,bits256 hash2);
void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_bundle *bp);
void iguana_update_balances(struct iguana_info *coin);
void iguana_RTspendvectors(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp);
int64_t iguana_RTbalance(struct iguana_info *coin,char *coinaddr);
double instantdex_avehbla(struct supernet_info *myinfo,double retvals[4],char *base,char *rel,double basevolume);
int32_t bitcoin_revealsecret160(uint8_t *script,int32_t n,uint8_t secret160[20]);
int64_t iguana_lockval(int32_t finalized,int64_t locktime);

Loading…
Cancel
Save