Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f5ba34f7b4
  1. 10
      crypto777/iguana_utils.c
  2. 206
      iguana/iguana_interpreter.c
  3. 13
      iguana/iguana_sign.c
  4. 18
      iguana/iguana_wallet.c

10
crypto777/iguana_utils.c

@ -291,9 +291,17 @@ int32_t is_hexstr(char *str,int32_t n)
int32_t i;
if ( str == 0 || str[0] == 0 )
return(0);
for (i=0; str[i]!=0&&(i<n||n==0); i++)
for (i=0; str[i]!=0; i++)
{
if ( n > 0 && i >= n )
break;
if ( _unhex(str[i]) < 0 )
{
if ( n == 0 )
return(i);
return(0);
}
}
return(n);
}

206
iguana/iguana_interpreter.c

@ -396,8 +396,8 @@ static inline int32_t is_delim(int32_t c)
else return(0);
}
union iguana_stacknum { int32_t val; int64_t val64; uint8_t rmd160[20]; bits256 hash2; uint8_t *data; };
struct iguana_stackdata { uint16_t size; union iguana_stacknum U; };
union iguana_stacknum { int32_t val; int64_t val64; uint8_t rmd160[20]; bits256 hash2; uint8_t pubkey[33]; uint8_t sig[74]; };
struct iguana_stackdata { uint8_t *data; uint16_t size; union iguana_stacknum U; };
struct iguana_interpreter
{
@ -406,7 +406,7 @@ struct iguana_interpreter
cJSON *logarray;
struct iguana_stackdata stack[];
};
static struct bitcoin_opcode { UT_hash_handle hh; uint8_t opcode,flags,stackitems; int8_t extralen; } *optable; static char *OPCODES[0x100]; static int32_t OPCODELENS[0x100];
static struct bitcoin_opcode { UT_hash_handle hh; uint8_t opcode,flags,stackitems; int8_t extralen; } *OPTABLE; static char *OPCODES[0x100]; static int32_t OPCODELENS[0x100];
static struct iguana_stackdata iguana_pop(struct iguana_interpreter *stacks)
{
@ -435,10 +435,10 @@ static struct iguana_stackdata iguana_clone(struct iguana_stackdata Snum)
{
struct iguana_stackdata clone;
clone = Snum;
if ( Snum.U.data != 0 )
if ( Snum.data != 0 )
{
clone.U.data = malloc(Snum.size);
memcpy(clone.U.data,Snum.U.data,Snum.size);
clone.data = malloc(Snum.size);
memcpy(clone.data,Snum.data,Snum.size);
}
return(clone);
}
@ -454,7 +454,11 @@ static int32_t iguana_isnonz(struct iguana_stackdata Snum)
buf = Snum.U.rmd160;
else if ( Snum.size == sizeof(bits256) )
buf = Snum.U.hash2.bytes;
else buf = Snum.U.data;
else if ( Snum.size == 33 )
buf = Snum.U.pubkey;
else if ( Snum.size < 74 )
buf = Snum.U.sig;
else buf = Snum.data;
for (i=0; i<Snum.size; i++)
if ( buf[i] != 0 )
return(1);
@ -473,6 +477,7 @@ static int32_t iguana_pushdata(struct iguana_interpreter *stacks,int64_t num64,u
struct iguana_stackdata Snum; cJSON *item = 0; char str[256]; int32_t num = (int32_t)num64;
if ( stacks->maxstackdepth > 0 )
{
printf("PUSHDATA.[%d]\n",numlen);
if ( stacks->stackdepth < stacks->maxstackdepth )
{
if ( stacks->logarray != 0 )
@ -511,10 +516,22 @@ static int32_t iguana_pushdata(struct iguana_interpreter *stacks,int64_t num64,u
if ( item != 0 )
jaddbits256(item,"push",Snum.U.hash2);
}
else if ( numlen == 33 )
{
memcpy(Snum.U.pubkey,numbuf,numlen);
if ( item != 0 )
jaddnum(item,"push",numlen);
}
else if ( numlen < 74 )
{
memcpy(Snum.U.sig,numbuf,numlen);
if ( item != 0 )
jaddnum(item,"push",numlen);
}
else
{
Snum.U.data = malloc(Snum.size);
memcpy(Snum.U.data,numbuf,numlen);
Snum.data = malloc(numlen);
memcpy(Snum.data,numbuf,numlen);
if ( item != 0 )
jaddnum(item,"push",numlen);
}
@ -522,8 +539,7 @@ static int32_t iguana_pushdata(struct iguana_interpreter *stacks,int64_t num64,u
}
else if ( num64 <= 0xffffffff ) // what about negative numbers?
Snum.U.val = num, Snum.size = sizeof(num);
else
Snum.U.val64 = num64, Snum.size = sizeof(num64);
else Snum.U.val64 = num64, Snum.size = sizeof(num64);
if ( item != 0 )
{
jaddnum(item,"depth",stacks->stackdepth);
@ -546,7 +562,11 @@ int32_t iguana_databuf(uint8_t *databuf,struct iguana_stackdata Snum)
memcpy(databuf,&Snum.U.rmd160,20);
else if ( Snum.size == 32 )
memcpy(databuf,&Snum.U.hash2.bytes,32);
else memcpy(databuf,&Snum.U.data,Snum.size);
else if ( Snum.size == 33 )
memcpy(databuf,&Snum.U.pubkey,33);
else if ( Snum.size < 74 )
memcpy(databuf,&Snum.U.sig,Snum.size);
else memcpy(databuf,&Snum.data,Snum.size);
return(Snum.size);
}
@ -562,7 +582,11 @@ static int32_t iguana_cmp(struct iguana_stackdata *a,struct iguana_stackdata *b)
return(memcmp(a->U.rmd160,b->U.rmd160,sizeof(a->U.rmd160)) == 0);
else if ( a->size == 32 )
return(memcmp(a->U.hash2.bytes,b->U.hash2.bytes,sizeof(a->U.hash2)) == 0);
else return(memcmp(a->U.data,b->U.data,sizeof(a->size)) == 0);
else if ( a->size == 33 )
return(memcmp(a->U.pubkey,b->U.pubkey,33) == 0);
else if ( a->size < 74 )
return(memcmp(a->U.sig,b->U.sig,a->size) == 0);
else return(memcmp(a->data,b->data,sizeof(a->size)) == 0);
}
return(-1);
}
@ -572,12 +596,13 @@ static int32_t iguana_dataparse(struct iguana_interpreter *stacks,uint8_t *scrip
int32_t n,c,len; char tmp[4];
*lenp = 0;
c = str[0];
if ( (n= is_hexstr(str,0)) > 0 )
n = is_hexstr(str,0);
if ( n > 0 )
{
if ( (n & 1) != 0 )
len = (n+1) >> 1;
else len = n >> 1;
if ( len < 76 )
if ( len > 0 && len < 76 )
{
if ( len == 1 )
{
@ -752,58 +777,94 @@ int32_t iguana_checksequenceverify(struct iguana_info *coin,int64_t nLockTime,ui
return(0);
}
void iguana_optableinit(struct iguana_info *coin)
{
int32_t i,extralen; uint8_t stackitems,flags; char *opname; struct bitcoin_opcode *op;
if ( OPTABLE == 0 )
{
for (i=0; i<0x100; i++)
OPCODES[i] = "OP_UNKNOWN";
for (i=0; i<0x100; i++)
{
extralen = stackitems = flags = 0;
opname = (char *)get_opname(&stackitems,&flags,&extralen,i);
if ( strcmp("OP_UNKNOWN",opname) != 0 )
{
op = calloc(1,sizeof(*op));
HASH_ADD_KEYPTR(hh,OPTABLE,opname,strlen(opname),op);
//printf("{%-16s %02x} ",opname,i);
op->opcode = i;
op->flags = flags;
op->stackitems = stackitems;
op->extralen = extralen;
OPCODES[i] = (char *)op->hh.key;
OPCODELENS[i] = (int32_t)strlen(OPCODES[i]);
}
}
//printf("bitcoin opcodes\n");
}
}
int32_t iguana_expandscript(struct iguana_info *coin,char *asmstr,int32_t maxlen,uint8_t *script,int32_t scriptlen)
{
int32_t len,i = 0; uint8_t opcode; uint32_t val,extraflag;
int32_t len,n,j,i = 0; uint8_t opcode; uint32_t val,extraflag;
iguana_optableinit(coin);
asmstr[0] = len = 0;
while ( i < scriptlen )
{
val = extraflag = 0;
opcode = script[i++];
if ( opcode == OP_1NEGATE )
if ( opcode > 0 && opcode < 76 )
{
asmstr[len++] = '-';
asmstr[len++] = '1';
for (j=0; j<opcode; j++)
sprintf(&asmstr[len],"%02x",script[i++]), len += 2;
}
else if ( opcode == OP_0 )
else if ( opcode >= IGUANA_OP_1 && opcode <= IGUANA_OP_16 )
{
sprintf(&asmstr[len],"%d",opcode - IGUANA_OP_1 + 1);
len += strlen(&asmstr[len]);
}
else if ( opcode == IGUANA_OP_0 )
{
strcpy(&asmstr[len],"OP_FALSE");
len += 8;
}
else if ( opcode >= OP_1 && opcode <= OP_16 )
else if ( opcode == IGUANA_OP_1NEGATE )
{
sprintf(&asmstr[len],"%d",opcode - OP_1 + 1);
len += strlen(&asmstr[len]);
asmstr[len++] = '-';
asmstr[len++] = '1';
}
else
{
//printf("dest.%p <- %p %02x\n",&asmstr[len],OPCODES[opcode],opcode);
strcpy(&asmstr[len],OPCODES[opcode]);
len += OPCODELENS[opcode];
}
if ( i < scriptlen )
asmstr[len++] = ' ';
if ( opcode == OP_PUSHDATA1 )
if ( opcode == IGUANA_OP_PUSHDATA1 )
{
sprintf(&asmstr[len],"%02x",script[i++]);
len += 2;
n = script[i++];
for (j=0; j<n; j++)
sprintf(&asmstr[len],"%02x",script[i++]), len += 2;
extraflag = 1;
}
else if ( opcode == OP_PUSHDATA2 )
else if ( opcode == IGUANA_OP_PUSHDATA2 )
{
val = script[i++];
val = (val << 8) | script[i++];
sprintf(&asmstr[len],"%04x",val);
len += 4;
n = script[i++];
n = (n << 8) | script[i++];
for (j=0; j<n; j++)
sprintf(&asmstr[len],"%02x",script[i++]), len += 2;
extraflag = 1;
}
else if ( opcode == OP_PUSHDATA4 )
else if ( opcode == IGUANA_OP_PUSHDATA4 )
{
val = script[i++];
val = (val << 8) | script[i++];
val = (val << 8) | script[i++];
val = (val << 8) | script[i++];
sprintf(&asmstr[len],"%08x",val);
len += 8;
n = script[i++];
n = (n << 8) | script[i++];
n = (n << 8) | script[i++];
n = (n << 8) | script[i++];
for (j=0; j<n; j++)
sprintf(&asmstr[len],"%02x",script[i++]), len += 2;
extraflag = 1;
}
if ( extraflag != 0 && i < scriptlen )
@ -817,6 +878,9 @@ cJSON *iguana_spendasm(struct iguana_info *coin,uint8_t *spendscript,int32_t spe
{
char asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; cJSON *spendasm = cJSON_CreateObject();
iguana_expandscript(coin,asmstr,sizeof(asmstr),spendscript,spendlen);
int32_t i; for (i=0; i<spendlen; i++)
printf("%02x",spendscript[i]);
printf(" -> (%s)\n",asmstr);
jaddstr(spendasm,"interpreter",asmstr);
return(spendasm);
}
@ -825,31 +889,9 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
{
struct bitcoin_opcode *op; cJSON *array = 0; struct iguana_interpreter STACKS,*stacks = &STACKS;
struct iguana_stackdata args[MAX_PUBKEYS_PER_MULTISIG];
uint8_t databuf[MAX_SCRIPT_ELEMENT_SIZE],flags,stackitems; char *asmstr,*str,*hexstr,*opname;
int32_t c,numops,numvars,numused,numargs,i,j,k,n,len,val,datalen,extralen,errs=0;
if ( optable == 0 )
{
for (i=0; i<0x100; i++)
OPCODES[i] = "OP_UNKNOWN";
for (i=0; i<0x100; i++)
{
extralen = stackitems = flags = 0;
opname = (char *)get_opname(&stackitems,&flags,&extralen,i);
if ( strcmp("OP_UNKNOWN",opname) != 0 )
{
op = calloc(1,sizeof(*op));
HASH_ADD_KEYPTR(hh,optable,opname,strlen(opname),op);
//printf("{%-16s %02x} ",opname,i);
op->opcode = i;
op->flags = flags;
op->stackitems = stackitems;
op->extralen = extralen;
OPCODES[i] = (char *)op->hh.key;
OPCODELENS[i] = (int32_t)strlen(OPCODES[i]);
}
}
//printf("bitcoin opcodes\n");
}
uint8_t databuf[MAX_SCRIPT_ELEMENT_SIZE]; char *asmstr,*str,*hexstr;
int32_t c,numops,plen,numvars,numused,numargs=0,i,j,k,n,len,val,datalen,errs=0;
iguana_optableinit(coin);
if ( (asmstr= jstr(interpreter,"interpreter")) == 0 )
return(-1);
if ( (numvars= juint(interpreter,"numvars")) > 0 )
@ -882,7 +924,11 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
for (i=0; i<V->N; i++)
{
if ( V->signers[i].siglen != 0 )
iguana_pushdata(stacks,0,V->signers[i].pubkey,bitcoin_pubkeylen(V->signers[i].pubkey));
{
plen = bitcoin_pubkeylen(V->signers[i].pubkey);
if ( V->spendscript[0] != plen || V->spendscript[V->spendlen - 1] != IGUANA_OP_CHECKSIG || bitcoin_pubkeylen(&V->spendscript[1]) <= 0 )
iguana_pushdata(stacks,0,V->signers[i].pubkey,plen);
}
}
if ( V->extras != 0 )
{
@ -905,8 +951,12 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
script[k] = 0;
while ( (c= *str++) != 0 )
{
while ( is_delim(c) != 0 )
if ( is_delim(c) != 0 )
{
//if ( c == 0 )
// break;
continue;
}
if ( c == '/' && *str == '/' ) // support //
break;
else if ( c == '-' && *str == '1' && is_delim(str[1]) != 0 )
@ -922,7 +972,7 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
{
if ( (n= iguana_dataparse(stacks,script,k,str,&len)) > 0 )
{
k = n;
k += n;
continue;
}
}
@ -935,7 +985,7 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
str--;
if ( (n= iguana_dataparse(stacks,script,k,str,&len)) > 0 )
{
k = n;
k += n;
str += len;
continue;
}
@ -954,15 +1004,18 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
errs++;
break;
}
HASH_FIND(hh,optable,str,j,op);
HASH_FIND(hh,OPTABLE,str,j,op);
str += j;
if ( op != 0 )
{
if ( numargs > 0 )
{
for (i=0; i<numargs; i++)
if ( args[i].U.data != 0 )
free(args[i].U.data);
if ( args[i].data != 0 )
{
printf("filter free\n");
free(args[i].data);
}
}
memset(args,0,sizeof(args));
numargs = 0;
@ -1099,7 +1152,7 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
iguana_pushdata(stacks,0,hash.bytes,sizeof(hash));
break;
case IGUANA_OP_CHECKSIG: case IGUANA_OP_CHECKSIGVERIFY:
iguana_pushdata(stacks,iguana_checksig(coin,args[0],args[1],V->sigtxid),0,0);
iguana_pushdata(stacks,iguana_checksig(coin,args[1],args[0],V->sigtxid),0,0);
break;
case IGUANA_OP_CHECKMULTISIG: case IGUANA_OP_CHECKMULTISIGVERIFY:
iguana_pushdata(stacks,iguana_checkmultisig(coin,stacks,V->M,V->N,V->sigtxid),0,0);
@ -1184,8 +1237,8 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
case IGUANA_OP_DUP: iguana_stack(stacks,args,1,"0","0"); break;
case IGUANA_OP_2DUP: iguana_stack(stacks,args,2,"01","01"); break;
case IGUANA_OP_NIP:
if ( args[0].U.data != 0 )
free(args[0].U.data);
if ( args[0].data != 0 )
free(args[0].data);
iguana_stack(stacks,args,2,"1","");
break;
case IGUANA_OP_OVER: iguana_stack(stacks,args,2,"01","0"); break;
@ -1297,8 +1350,11 @@ int32_t bitcoin_assembler(struct iguana_info *coin,uint8_t script[IGUANA_MAXSCRI
if ( numargs > 0 )
{
for (i=0; i<numargs; i++)
if ( args[i].U.data != 0 )
free(args[i].U.data);
if ( args[i].data != 0 )
{
printf("filter free\n");
//free(args[i].U.data);
}
}
free(stacks);
}

13
iguana/iguana_sign.c

@ -940,12 +940,12 @@ cJSON *iguana_scriptpubkeys(struct iguana_info *coin,uint8_t *script,int32_t scr
void iguana_addscript(struct iguana_info *coin,cJSON *dest,uint8_t *script,int32_t scriptlen,char *fieldname)
{
char *scriptstr,scriptbuf[8192+256]; int32_t len; cJSON *scriptobj;
char *scriptstr,scriptbuf[8192+256]; int32_t maxlen; cJSON *scriptobj;
if ( scriptlen < 0 )
return;
if ( scriptlen > sizeof(scriptbuf) )
len = (scriptlen << 1) + 256, scriptstr = malloc(len);
else scriptstr = scriptbuf, len = sizeof(scriptbuf);
maxlen = (scriptlen << 1) + 2048, scriptstr = malloc(maxlen);
else scriptstr = scriptbuf, maxlen = sizeof(scriptbuf);
init_hexbytes_noT(scriptstr,script,scriptlen);
if ( strcmp(fieldname,"coinbase") == 0 )
jaddstr(dest,"coinbase",scriptstr);
@ -953,7 +953,7 @@ void iguana_addscript(struct iguana_info *coin,cJSON *dest,uint8_t *script,int32
{
scriptobj = cJSON_CreateObject();
jaddstr(scriptobj,"hex",scriptstr);
iguana_expandscript(coin,scriptstr,len,script,scriptlen);
iguana_expandscript(coin,scriptstr,maxlen,script,scriptlen);
if ( scriptstr[0] != 0 )
jaddstr(scriptobj,"asm",scriptstr);
if ( scriptstr != scriptbuf )
@ -1127,7 +1127,7 @@ P2SH_SPENDAPI(iguana,spendmsig,activecoin,vintxid,vinvout,destaddress,destamount
int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_msgtx *msgtx,char **signedtxp,bits256 *signedtxidp,struct vin_info *V,int32_t numinputs,char *rawtx,cJSON *vins,cJSON *privkeys)
{
uint8_t *serialized,*serialized2,*serialized3; int32_t i,len,n,maxsize,complete = 0; char *checkstr,*privkeystr,*signedtx = 0; bits256 privkey,txid; cJSON *item; cJSON *txobj;
uint8_t *serialized,*serialized2,*serialized3; int32_t i,len,n,maxsize,complete = 0; char *checkstr,*privkeystr,*signedtx = 0; bits256 privkey,txid; cJSON *item; cJSON *txobj = 0;
maxsize = 1000000;
if ( rawtx != 0 && rawtx[0] != 0 && (len= (int32_t)strlen(rawtx)>>1) < maxsize )
{
@ -1151,7 +1151,6 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
}
free(checkstr);
}
free_json(txobj);
}
if ( (numinputs= cJSON_GetArraySize(vins)) > 0 )
{
@ -1177,6 +1176,8 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
}
}
} else return(-1);
if ( txobj != 0 )
free_json(txobj);
*signedtxp = signedtx;
return(complete);
}

18
iguana/iguana_wallet.c

@ -1226,6 +1226,8 @@ STRING_AND_THREEINTS(bitcoinrpc,getbalance,account,minconf,includeempty,lastheig
int64_t balance; int32_t numunspents,numrmds=0; uint8_t *rmdarray=0; cJSON *retjson;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( account == 0 )
account = "";
if ( minconf == 0 )
@ -1246,6 +1248,8 @@ STRING_ARG(bitcoinrpc,getaddressesbyaccount,account)
cJSON *retjson;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
retjson = cJSON_CreateObject();
jadd(retjson,"result",getaddressesbyaccount(myinfo,coin,account));
return(jprint(retjson,1));
@ -1256,6 +1260,8 @@ STRING_AND_INT(bitcoinrpc,getreceivedbyaccount,account,minconf)
cJSON *retjson; struct iguana_waccount *wacct; int64_t balance;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
retjson = cJSON_CreateObject();
if ( (wacct= iguana_waccountfind(myinfo,coin,account)) != 0 )
{
@ -1270,6 +1276,8 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
cJSON *retjson,*retarray,*txids,*vouts,*item,*array; int32_t vout,i,j,total,m,n = 0; struct iguana_waccount *wacct; char *coinaddr; bits256 txid;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
retjson = cJSON_CreateObject();
retarray = cJSON_CreateArray();
if ( (wacct= iguana_waccountfind(myinfo,coin,account)) != 0 )
@ -1335,6 +1343,8 @@ THREE_INTS(bitcoinrpc,listreceivedbyaccount,minconf,includeempty,watchonly)
cJSON *retjson,*item,*array; struct iguana_waccount *wacct,*tmp; int64_t balance;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
array = cJSON_CreateArray();
HASH_ITER(hh,myinfo->wallet,wacct,tmp)
{
@ -1355,6 +1365,8 @@ THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag)
cJSON *retjson,*item,*array,*txids,*vouts; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
array = cJSON_CreateArray();
HASH_ITER(hh,myinfo->wallet,wacct,tmp)
{
@ -1378,6 +1390,10 @@ THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag)
STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf)
{
char *balancestr; cJSON *balancejson,*retjson = cJSON_CreateObject();
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( (balancestr= iguana_balance(IGUANA_CALLARGS,coin->symbol,address,-1,minconf)) != 0 )
{
if ( (balancejson= cJSON_Parse(balancestr)) != 0 )
@ -1396,6 +1412,8 @@ TWO_INTS(bitcoinrpc,listaccounts,minconf,includewatchonly)
cJSON *retjson,*array; int64_t balance; struct iguana_waccount *wacct,*tmp;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
array = cJSON_CreateObject();
HASH_ITER(hh,myinfo->wallet,wacct,tmp)
{

Loading…
Cancel
Save