diff --git a/iguana/iguana_payments.c b/iguana/iguana_payments.c index 137913d64..f1e274c15 100755 --- a/iguana/iguana_payments.c +++ b/iguana/iguana_payments.c @@ -238,7 +238,7 @@ STRING_ARG(bitcoinrpc,validatepubkey,pubkeystr) STRING_ARG(bitcoinrpc,decodescript,scriptstr) { int32_t scriptlen; uint8_t script[IGUANA_MAXSCRIPTSIZE],rmd160[20]; char coinaddr[128],asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; cJSON *scriptobj,*retjson = cJSON_CreateObject(); - if ( coin != 0 && (scriptlen= (int32_t)strlen(scriptstr)>>1) < sizeof(script) ) + if ( scriptstr != 0 && coin != 0 && (scriptlen= (int32_t)strlen(scriptstr)>>1) < sizeof(script) ) { decode_hex(script,scriptlen,scriptstr); if ( (scriptobj= iguana_scriptobj(coin,rmd160,coinaddr,asmstr,script,scriptlen)) != 0 ) diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index d84e72011..c61331c34 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -827,8 +827,12 @@ STRING_ARG(bitcoinrpc,validateaddress,address) retjson = cJSON_CreateObject(); jaddstr(retjson,"result","success"); jaddnum(retjson,"addrtype",addrtype); - init_hexbytes_noT(str,rmd160,sizeof(rmd160)); - jaddstr(retjson,"rmd160",str); + init_hexbytes_noT(str+6,rmd160,sizeof(rmd160)); + jaddstr(retjson,"rmd160",str+6); + memcpy(str,"76a914",6); + strcat(str,"88ac"); + jaddstr(retjson,"scriptPubKey",str); + jadd(retjson,"isscript",(addrtype == coin->chain->p2shtype) ? jtrue() : jfalse()); if ( iguana_ismine(myinfo,coin,addrtype,pubkey,rmd160) > 0 ) { init_hexbytes_noT(str,pubkey,bitcoin_pubkeylen(pubkey));