|
|
@ -481,12 +481,11 @@ int64_t iguana_lockval(int32_t finalized,int64_t locktime) |
|
|
|
|
|
|
|
int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,struct iguana_msgtx *msgtx,char **signedtxp,bits256 *signedtxidp,struct vin_info *V,int32_t numinputs,char *rawtx,cJSON *vins,cJSON *privkeysjson,int32_t zcash) |
|
|
|
{ |
|
|
|
uint8_t *serialized,*serialized2,*serialized3,*serialized4,*extraspace,pubkeys[64][33]; int32_t finalized,i,len,n,z,plen,maxsize,complete = 0,extralen = 100000; char *privkeystr,*signedtx = 0; bits256 *privkeys,privkey,txid; cJSON *item; cJSON *txobj = 0; |
|
|
|
uint8_t *serialized,*serialized2,*serialized3,*serialized4,*extraspace,pubkeys[64][33]; int32_t finalized,i,len,n,z,plen,maxsize,complete = 0,extralen = 100000; char *privkeystr,*signedtx = 0; bits256 privkeys[LP_MAXVINS],privkey,txid; cJSON *item; cJSON *txobj = 0; |
|
|
|
maxsize = 1000000; |
|
|
|
memset(privkey.bytes,0,sizeof(privkey)); |
|
|
|
if ( rawtx != 0 && rawtx[0] != 0 && (len= (int32_t)strlen(rawtx)>>1) < maxsize ) |
|
|
|
{ |
|
|
|
privkeys = calloc(numinputs+1024,sizeof(*privkeys)); |
|
|
|
serialized = malloc(maxsize); |
|
|
|
serialized2 = malloc(maxsize); |
|
|
|
serialized3 = malloc(maxsize); |
|
|
@ -506,7 +505,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ |
|
|
|
if ( iguana_rwmsgtx(taddr,pubtype,p2shtype,isPoS,height,0,0,serialized,maxsize,msgtx,&txid,"",extraspace,extralen,vins,V->suppress_pubkeys,zcash) > 0 && numinputs == msgtx->tx_in ) |
|
|
|
{ |
|
|
|
memset(pubkeys,0,sizeof(pubkeys)); |
|
|
|
memset(privkeys,0,sizeof(*privkeys)*numinputs); |
|
|
|
memset(privkeys,0,sizeof(privkeys)); |
|
|
|
if ( (n= cJSON_GetArraySize(privkeysjson)) > 0 ) |
|
|
|
{ |
|
|
|
for (i=0; i<n; i++) |
|
|
@ -602,7 +601,6 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ |
|
|
|
} else printf("rwmsgtx error\n"); |
|
|
|
} else printf("no inputs in vins.(%s)\n",vins!=0?jprint(vins,0):"null"); |
|
|
|
free(extraspace); |
|
|
|
free(privkeys); |
|
|
|
free(serialized), free(serialized2), free(serialized3), free(serialized4); |
|
|
|
} else return(-1); |
|
|
|
if ( txobj != 0 ) |
|
|
@ -1004,7 +1002,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ |
|
|
|
char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys,int64_t txfee,bits256 utxotxid,int32_t utxovout,uint32_t locktime) |
|
|
|
{ |
|
|
|
static void *ctx; |
|
|
|
cJSON *txobj,*item; uint8_t addrtype,rmd160[20],script[64],spendscript[256]; char *coinaddr,*rawtxbytes; bits256 txid; uint32_t timestamp; int64_t change=0,adjust=0,total,value,amount = 0; int32_t i,dustcombine,scriptlen,spendlen,suppress_pubkeys,ignore_cltverr,numvouts=0,numvins=0,numutxos=0; struct LP_address_utxo *utxos[1024]; struct LP_address *ap; |
|
|
|
cJSON *txobj,*item; uint8_t addrtype,rmd160[20],script[64],spendscript[256]; char *coinaddr,*rawtxbytes; bits256 txid; uint32_t timestamp; int64_t change=0,adjust=0,total,value,amount = 0; int32_t i,dustcombine,scriptlen,spendlen,suppress_pubkeys,ignore_cltverr,numvouts=0,numvins=0,numutxos=0; struct LP_address_utxo *utxos[LP_MAXVINS]; struct LP_address *ap; |
|
|
|
if ( ctx == 0 ) |
|
|
|
ctx = bitcoin_ctx(); |
|
|
|
*numvinsp = 0; |
|
|
@ -1143,7 +1141,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) |
|
|
|
safecopy(changeaddr,coin->smartaddr,sizeof(changeaddr)); |
|
|
|
safecopy(vinaddr,coin->smartaddr,sizeof(vinaddr)); |
|
|
|
privkey = LP_privkey(vinaddr,coin->taddr); |
|
|
|
maxV = 1024; |
|
|
|
maxV = LP_MAXVINS; |
|
|
|
V = malloc(maxV * sizeof(*V)); |
|
|
|
for (iter=0; iter<2; iter++) |
|
|
|
{ |
|
|
|