Browse Source

basilisk sendtoaddress

release/v0.1
jl777 8 years ago
committed by Christopher Valerio
parent
commit
4aa13e7d60
  1. 2
      basilisk/basilisk_bitcoin.c
  2. 1
      iguana/coins/genblk
  3. 2
      iguana/iguana_bundles.c
  4. 4
      iguana/iguana_peers.c
  5. 12
      iguana/iguana_scripts.c
  6. 2
      iguana/iguana_unspents.c
  7. 38
      iguana/iguana_wallet.c
  8. 1
      includes/iguana_funcs.h

2
basilisk/basilisk_bitcoin.c

@ -563,7 +563,7 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi
} else oplen = datachain_opreturnscript(coin,buf,opreturn,oplen);
}
rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,amount,changeaddr,txfee,addresses,minconf,oplen!=0?buf:0,oplen+offset,burnamount,remoteaddr);
printf("generated.(%s) vins.(%s)\n",rawtx!=0?rawtx:"",vins!=0?jprint(vins,0):"");
//printf("generated.(%s) vins.(%s)\n",rawtx!=0?rawtx:"",vins!=0?jprint(vins,0):"");
}
if ( rawtx != 0 )
{

1
iguana/coins/genblk

@ -0,0 +1 @@
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\":\"BLK\",\"name\":\"BlackCoin\",\"netmagic\":\"70352205\",\"p2p\":15714,\"rpc\":15715,\"pubval\":25,\"p2shval\":85,\"wifval\":153,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"000001faef25dec4fbcf906e6242621df2c183bf232f263d0ba5b101911e4563\",\"genesis\":{\"hashalgo\":\"scrypt\",\"version\":1,\"timestamp\":1393221600,\"nBits\":\"1e0fffff\",\"nonce\":164482,\"merkle_root\":\"12630d16a97f24b287c8c2594dda5fb98c9e6c70fc61d44191931ea2aa08dc90\"},\"alertpubkey\":\"0486bce1bac0d543f104cbff2bd23680056a3b9ea05e1137d2ff90eeb5e08472eb500322593a2cb06fbf8297d7beb6cd30cb90f98153b5b7cce1493749e41e0284\",\"isPoS\":1}"

2
iguana/iguana_bundles.c

@ -1548,7 +1548,7 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch
fprintf(logfp,"%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
fflush(logfp);
}
//printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
strcpy(coin->lastdispstr,str);
if ( (rand() % 100) == 0 )
myallocated(0,0);

4
iguana/iguana_peers.c

@ -724,12 +724,12 @@ void iguana_startconnection(void *arg)
printf("iguana_startconnection.%s:%04x mismatched coin.%p (%s) vs (%s)\n",addr->ipaddr,coin->chain->portp2p,coin,coin->symbol,addr->coinname);
return;
}
if ( strcmp("85.25.217.233",addr->ipaddr) == 0 )
/*if ( strcmp("85.25.217.233",addr->ipaddr) == 0 )
{
printf("temp blacklist %s\n",addr->ipaddr);
iguana_iAkill(coin,addr,1);
return;
}
}*/
//printf("%s iguana_startconnection.%s:%04x\n",coin->symbol,addr->ipaddr,coin->chain->portp2p);
if ( strcmp("127.0.0.1",addr->ipaddr) == 0 )//&& (coin->myservices & NODE_NETWORK) != 0 )
{

12
iguana/iguana_scripts.c

@ -446,6 +446,18 @@ int32_t iguana_calcrmd160(struct iguana_info *coin,char *asmstr,struct vin_info
return(vp->type);
}
char *iguana_scriptaddress(struct iguana_info *coin,char *coinaddr,uint8_t *script,int32_t scriptlen)
{
struct vin_info V;
iguana_calcrmd160(coin,0,&V,script,scriptlen,GENESIS_PUBKEY,0,0xffffffff);
if ( V.coinaddr[0] != 0 )
{
strcpy(coinaddr,V.coinaddr);
return(coinaddr);
}
return(0);
}
//error memalloc mem.0x7f6fc6e4a2a8 94.242.229.158 alloc 1 used 2162688 totalsize.2162688 -> 94.242.229.158 (nil)
int32_t bitcoin_scriptget(struct iguana_info *coin,int32_t *hashtypep,uint32_t *sigsizep,uint32_t *pubkeysizep,uint8_t **userdatap,uint32_t *userdatalenp,struct vin_info *vp,uint8_t *scriptsig,int32_t len,int32_t spendtype)

2
iguana/iguana_unspents.c

@ -988,7 +988,7 @@ int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info *
iguana_outptset(myinfo,coin,&outpt,jbits256(item,"txid"),jint(item,"vout"),jdouble(item,"amount") * SATOSHIDEN,spendscriptstr);
*unspents = outpt;
sum += outpt.value;
printf("ITEM.(%s) %.8f\n",jprint(item,0),dstr(outpt.value));
//printf("ITEM.(%s) %.8f\n",jprint(item,0),dstr(outpt.value));
unspents++;
numunspents++;
if ( numunspents > max || sum > required )

38
iguana/iguana_wallet.c

@ -950,13 +950,31 @@ int64_t oldiguana_waccountbalance(struct supernet_info *myinfo,struct iguana_inf
cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins)
{
int32_t i,j,n,numinputs; struct iguana_waddress *waddr; struct iguana_outpoint spentpt; struct iguana_waccount *wacct; char *addresses,*address,coinaddr[64]; cJSON *privkeys = cJSON_CreateArray();
int32_t i,j,n,numinputs,scriptlen; struct iguana_waddress *waddr; struct iguana_waccount *wacct; char *addresses,*address,*scripthexstr,coinaddr[64]; cJSON *scriptobj,*privkeys,*item; uint8_t spendscript[IGUANA_MAXSCRIPTSIZE];
privkeys = cJSON_CreateArray();
if ( (numinputs= cJSON_GetArraySize(vins)) > 0 )
{
addresses = calloc(numinputs,64);
for (i=n=0; i<numinputs; i++)
{
if ( (address= iguana_RTinputaddress(myinfo,coin,coinaddr,&spentpt,jitem(vins,i))) != 0 )
address = 0;
item = jitem(vins,i);
if ( (address= jstr(item,"address")) == 0 )
{
if ( (scripthexstr= jstr(item,"spendscript")) == 0 )
{
if ( (scriptobj= jobj(item,"scriptPubkey")) != 0 )
scripthexstr = jstr(scriptobj,"hex");
}
if ( scripthexstr != 0 )
{
scriptlen = (int32_t)strlen(scripthexstr) >> 1;
decode_hex(spendscript,scriptlen,scripthexstr);
address = iguana_scriptaddress(coin,coinaddr,spendscript,scriptlen);
}
}
//if ( (address= iguana_RTinputaddress(myinfo,coin,coinaddr,&spentpt,jitem(vins,i))) != 0 )
if ( address != 0 )
{
for (j=0; j<n; j++)
{
@ -965,7 +983,7 @@ cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin
}
if ( j == n )
strcpy(&addresses[64 * n++],address);
}
} else printf("cant get address from.(%s)\n",jprint(item,0));
}
for (i=0; i<n; i++)
{
@ -1140,14 +1158,20 @@ ZERO_ARGS(bitcoinrpc,getinfo)
{
getinfoobj = jduplicate(jitem(array,0));
longest = 0;
if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 && (n= cJSON_GetArraySize(array)) > 1 )
if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 && (n= cJSON_GetArraySize(array)) > 0 )
{
jdelete(getinfoobj,"longestchain");
for (i=0; i<n; i++)
{
item = jitem(array,i);
if ( juint(getinfoobj,"longestchain") > longest )
longest = juint(getinfoobj,"longestchain");
if ( juint(item,"longestchain") > longest )
longest = juint(item,"longestchain");
if ( juint(item,"RTheight") > coin->RTheight )
{
coin->RTheight = juint(item,"RTheight");
coin->firstRTheight = juint(item,"firstRTheight");
printf("set RTheight.%d 1st %d\n",coin->RTheight,coin->firstRTheight);
}
if ( (fullnodes= jarray(&m,item,"supernet")) != 0 )
{
for (j=0; j<m; j++)
@ -1157,6 +1181,8 @@ ZERO_ARGS(bitcoinrpc,getinfo)
}
}
}
if ( jobj(getinfoobj,"longestchain") != 0 )
jdelete(getinfoobj,"longestchain");
jaddnum(getinfoobj,"longestchain",longest);
}
}

1
includes/iguana_funcs.h

@ -383,6 +383,7 @@ int32_t iguana_convert(struct iguana_info *coin,int32_t helperid,struct iguana_b
int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp,int32_t priority,double mult);
FILE *myfopen(char *fname,char *mode);
int32_t myfclose(FILE *fp);
char *iguana_scriptaddress(struct iguana_info *coin,char *coinaddr,uint8_t *script,int32_t scriptlen);
int32_t iguana_walkchain(struct iguana_info *coin,int32_t skipflag);
struct iguana_block *iguana_fastlink(struct iguana_info *coin,int32_t hwmheight);
int32_t iguana_balancenormal(struct iguana_info *coin,struct iguana_bundle *bp,int32_t startheight,int32_t endheight);

Loading…
Cancel
Save