Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
a2b78dd7cf
  1. 2
      basilisk/basilisk_swap.c
  2. 2
      iguana/iguana_sign.c
  3. 6
      iguana/iguana_unspents.c
  4. 2
      iguana/main.c
  5. 2
      iguana/tests/decodegtx
  6. 2
      iguana/tests/decoderawtransaction

2
basilisk/basilisk_swap.c

@ -237,7 +237,7 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,struct basilisk_swap *s
txobj = bitcoin_txoutput(txobj,dest->spendscript,dest->spendlen,dest->amount);
if ( (rawtxbytes= bitcoin_json2hex(myinfo,rawtx->coin,&dest->txid,txobj,&V)) != 0 )
{
printf("spend rawtx.(%s) userdatalen.%d\n",rawtxbytes,userdatalen);
printf("(%s) spend rawtx.(%s) userdatalen.%d p2shlen.%d\n",jprint(txobj,0),rawtxbytes,userdatalen,dest->redeemlen);
if ( (signedtx= iguana_signrawtx(myinfo,rawtx->coin,&dest->signedtxid,&dest->completed,vins,rawtxbytes,privkeys,&V)) != 0 )
{
printf("rawtx spend signedtx.(%s)\n",signedtx);

2
iguana/iguana_sign.c

@ -1099,7 +1099,7 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
if ( (txobj= bitcoin_hex2json(coin,&txid,msgtx,rawtx,extraspace,extralen,serialized4)) != 0 )
{
//printf("txobj.(%s)\n",jprint(txobj,0));
if ( (checkstr= bitcoin_json2hex(myinfo,coin,&txid,txobj,0)) != 0 )
if ( extralen == 0 && (checkstr= bitcoin_json2hex(myinfo,coin,&txid,txobj,0)) != 0 )
{
if ( strcmp(rawtx,checkstr) != 0 )
{

6
iguana/iguana_unspents.c

@ -98,6 +98,7 @@ int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *
int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,uint8_t *spendscript,int32_t *spendlenp,uint64_t *valuep,int32_t *heightp,bits256 txid,int32_t vout,int32_t lasthdrsi,int32_t mempool)
{
struct iguana_txid *tp,TX; struct gecko_memtx *memtx; struct iguana_pkhash *P; struct iguana_unspent *U; struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int64_t RTspend; int64_t value; int32_t pkind,hdrsi,firstvout,spentheight,flag=0,unspentind = -1;
portable_mutex_lock(&coin->RTmutex);
if ( valuep != 0 )
*valuep = 0;
if ( coinaddr != 0 )
@ -142,6 +143,7 @@ int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *c
}
}
}
portable_mutex_unlock(&coin->RTmutex);
return(unspentind);
}
@ -524,7 +526,7 @@ int32_t iguana_pkhasharray(struct supernet_info *myinfo,struct iguana_info *coin
int64_t iguana_unspents(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *array,int32_t minconf,int32_t maxconf,uint8_t *rmdarray,int32_t numrmds,int32_t lastheight,int64_t *unspents,int32_t *numunspentsp,char *remoteaddr)
{
int64_t total=0,sum=0; struct iguana_pkhash *P; uint8_t *addrtypes,*pubkeys; int32_t i,numunspents,maxunspents,flag = 0; char coinaddr[64];
portable_mutex_lock(&coin->RTmutex);
//portable_mutex_lock(&coin->RTmutex);
if ( coin->RTramchain_busy != 0 )
fprintf(stderr,"iguana_pkhasharray: unexpected access when RTramchain_busy\n");
numunspents = 0;
@ -551,7 +553,7 @@ int64_t iguana_unspents(struct supernet_info *myinfo,struct iguana_info *coin,cJ
*numunspentsp = numunspents;
if ( flag != 0 && rmdarray != 0 )
free(rmdarray);
portable_mutex_unlock(&coin->RTmutex);
//portable_mutex_unlock(&coin->RTmutex);
return(sum);
}

2
iguana/main.c

@ -551,7 +551,7 @@ void iguana_appletests(struct supernet_info *myinfo)
bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33);
printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
getchar();**/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
{
free(str);
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 )

2
iguana/tests/decodegtx

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"DEX\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000c3e763570001000000000000000006056adeadbeef00000000\"]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"DEX\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000018efaaa9bdf615b126eb7c84aad2b2dfa3517cd885d35be4584cceec61f619d0a0000000001014c68630405c5a357b1752102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac67a914f0a979f6abfb2f9e2e76b96b9252307d3b873f5088210398a4cb9f6ea7c52a4e27455028a95e2e4e397a110fb75f072c2c58a8bdcbf4baac68510000000001db390000000000001976a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac05c5a357\"]}"

2
iguana/tests/decoderawtransaction

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

Loading…
Cancel
Save