Browse Source

possible fix for issue 53

release/v0.1
jl777 8 years ago
parent
commit
5669a56c36
  1. 9
      iguana/iguana_payments.c
  2. 2
      iguana/iguana_wallet.c
  3. 2
      iguana/tests/decoderawtransaction
  4. 2
      iguana/tests/sendtoaddress

9
iguana/iguana_payments.c

@ -444,16 +444,17 @@ void iguana_RTunspentslock(struct supernet_info *myinfo,struct iguana_info *coin
char *sendtoaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,char *coinaddr,uint64_t satoshis,uint64_t txfee,char *comment,char *comment2,int32_t minconf,char *account)
{
uint8_t addrtype,spendscript[1024],rmd160[20]; int32_t completed; char *retstr,spendscriptstr[4096],*rawtx=0,*signedtx = 0; bits256 signedtxid,senttxid; cJSON *retjson,*vins,*addresses,*valsobj; uint32_t spendlen,locktime = 0; struct iguana_waddress *waddr; uint32_t basilisktag;
uint8_t addrtype,spendscript[1024],rmd160[20]; int32_t completed; char *retstr,spendscriptstr[4096],*rawtx=0,*signedtx = 0; bits256 signedtxid,senttxid; cJSON *retjson,*vins,*addresses,*valsobj; uint32_t spendlen,locktime = 0; uint32_t basilisktag;
//sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to] <amount> is a real and is rounded to 8 decimal places. Returns the transaction ID <txid> if successful. Y
if ( account == 0 || account[0] == 0 )
account = "*";
addresses = iguana_getaddressesbyaccount(myinfo,coin,account);
if ( coin->changeaddr[0] == 0 )
{
if ( (waddr= iguana_getaccountaddress(myinfo,coin,0,0,coin->changeaddr,"change")) == 0 )
return(clonestr("{\"error\":\"no change address specified\"}"));
strcpy(coin->changeaddr,waddr->coinaddr);
//if ( (waddr= iguana_getaccountaddress(myinfo,coin,0,0,coin->changeaddr,"change")) == 0 )
// return(clonestr("{\"error\":\"no change address specified\"}"));
bitcoin_address(coin->changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33);
printf("%s change %s\n",coin->symbol,coin->changeaddr);
}
if ( coinaddr != 0 && coinaddr[0] != 0 && satoshis != 0 )
{

2
iguana/iguana_wallet.c

@ -1094,7 +1094,7 @@ struct iguana_waddress *iguana_getaccountaddress(struct supernet_info *myinfo,st
wacct = iguana_waccountcreate(myinfo,account);
if ( wacct != 0 )
{
if ( (waddr= wacct->current) == 0 )
if ( (waddr= wacct->current) == 0 || waddr->numunspents > 0 )
{
if ( (retstr= SuperNET_login(IGUANA_CALLARGS,myinfo->handle,myinfo->secret,myinfo->permanentfile,myinfo->password)) != 0 )
{

2
iguana/tests/decoderawtransaction

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000ab71aa5701b8b5b227160b1ddff8c851ef1750b4f73b8e24138b931d3befbf5d0b051c6cd200000000904730440220112c68dd9ac6b9f8d81c226b1cc72be7f4e75d9f81db82adf6931d23d45ccf360220266df0681e89fb3f603118a8f3764122eb2a131cbcc1d8cfa61351e1989adf0c0147304402203022147b0ae5135e413cd116db7310942f46bb91cc2dbebd30d814a09fe624d1022022725baa7aaea080c4c050da69bac4c70e7fb9b317190f51d7a3e263affe7d1801ffffffff01706f9800000000001976a91454a752f0d71b89d7c014ed0be29ca231c9546f9f88ac00000000\", 1]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000193cbb570289f3d9a6dbc265caae9eb4c2c1176b546270fa48310da4c3593c8f764e914ec3010000006a473044022006f5fd779b3eec22bef3d204e2b4b9cd2c6de6384b90f42e882011c0dc41eafd0220181e702bc90e8e90ad5d7495f177904a78faacf36ef507f7f4b55d03e9bd55550121020ce8ffc263769bfa15579b2757873ea5690107acfafb6dc1b77cd7057ac38349ffffffff466304197095eeceb34a9b8cc57b34a9d069f37cb3c0aedcb71c5f3c0858afd5010000006a473044022002ff607e81647700daa1960850bec94c42ab11eed7a4a9088257f2358eb7012f022020da58ebcc41a704d466cf3a82494ae838b7f1b8ce6a14e8010ab16abb15ec790121020ce8ffc263769bfa15579b2757873ea5690107acfafb6dc1b77cd7057ac38349ffffffff02804a5d05000000001976a914ec3ed21928ca63954b87eefa887de6464c46d3cc88acf0b6cf01000000001976a91421e112f4211cbc612bc5f3de86acf0017b88b67d88ac00000000\", 1]}"

2
iguana/tests/sendtoaddress

@ -1,2 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"sendtoaddress\",\"params\":[\"RQCP1TcfevTQU35ZftPNx2TZpB9ZkSZQ3S\", 0.001, \"testcomment\", \"sendcomment\"]}"
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"sendtoaddress\",\"params\":[\"RWpLoeTF17e57h2dztWjVtFiPGJN68oWwx\", 0.9, \"testcomment\", \"sendcomment\"]}"

Loading…
Cancel
Save