Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
8072d7ad8c
  1. 9
      basilisk/basilisk_bitcoin.c
  2. 2
      iguana/tests/decoderawtransaction

9
basilisk/basilisk_bitcoin.c

@ -890,7 +890,7 @@ HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr)
return(basilisk_standardservice("BAL",myinfo,0,hash,vals,hexstr,1));
}
cJSON *basilisk_history_item(int64_t *totalp,char *coinaddr,int64_t value,uint32_t timestamp,bits256 txid,char *vinvoutstr,int32_t vinvout,int32_t height,char *otherheightstr,int32_t otherheight,uint64_t relaymask,int32_t ismine)
cJSON *basilisk_history_item(struct iguana_info *coin,int64_t *totalp,char *coinaddr,int64_t value,uint32_t timestamp,bits256 txid,char *vinvoutstr,int32_t vinvout,int32_t height,char *otherheightstr,int32_t otherheight,uint64_t relaymask,int32_t ismine)
{
cJSON *item,*details;
item = cJSON_CreateObject();
@ -903,6 +903,9 @@ cJSON *basilisk_history_item(int64_t *totalp,char *coinaddr,int64_t value,uint32
jaddbits256(details,"txid",txid);
jaddnum(details,vinvoutstr,vinvout);
jaddnum(details,"height",height);
if ( coin->blocks.hwmchain.height > 0 )
jaddnum(details,"confirms",coin->blocks.hwmchain.height - height);
jaddnum(details,"height",height);
if ( otherheight != 0 )
jaddnum(details,otherheightstr,otherheight);
else *totalp += value;
@ -936,7 +939,7 @@ HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr)
if ( strcmp(bu->symbol,coin->symbol) == 0 )
{
bitcoin_address(waddr->coinaddr,coin->chain->pubtype,waddr->rmd160,sizeof(waddr->rmd160));
jaddi(array,basilisk_history_item(&total,waddr->coinaddr,bu->value,bu->timestamp,bu->txid,"vout",bu->vout,bu->height,"spentheight",bu->spentheight,bu->relaymask,-1));
jaddi(array,basilisk_history_item(coin,&total,waddr->coinaddr,bu->value,bu->timestamp,bu->txid,"vout",bu->vout,bu->height,"spentheight",bu->spentheight,bu->relaymask,-1));
//printf("%s %s i.%d numunspents.%d\n",coin->symbol,waddr->coinaddr,i,waddr->numunspents);
}
}
@ -950,7 +953,7 @@ HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr)
s = &myinfo->spends[i];
//struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64]; };
if ( strcmp(s->symbol,coin->symbol) == 0 )
jaddi(array,basilisk_history_item(&totalspent,s->destaddr,s->value,s->timestamp,s->txid,"vin",s->vini,s->height,"unspentheight",s->unspentheight,s->relaymask,s->ismine));
jaddi(array,basilisk_history_item(coin,&totalspent,s->destaddr,s->value,s->timestamp,s->txid,"vin",s->vini,s->height,"unspentheight",s->unspentheight,s->relaymask,s->ismine));
}
}
portable_mutex_unlock(&myinfo->bu_mutex);

2
iguana/tests/decoderawtransaction

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000016b7fd1559c5b5741bb5a2a4c4b7ec3d58dad5b446443b46af871f7c78f87e1c000000000d2483045022100fe525e98f13f57b1db4137b63898eb5c5110686220f936fbfba947eb2ba95e2a0220666c4ff5c818a553b1a3dd1834b9d90b45ec8bce5219e16396612f0c69a885ec012029eaebaaacbf20946af0141977494304985804bb3a799b3cfcd67f95e7d9101e004c6763042027a957b1752103175cf93574c31637b8c2d8acd5319e3cd23761b5e418d32c6bcb194972ba9273ac67a91461c860a1e8cc35ff310ba0f86e568fc6ebfff511882102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac68ffffffff01474d0000000000001976a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac00000000\", 1]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"010000000f0ea95701466304197095eeceb34a9b8cc57b34a9d069f37cb3c0aedcb71c5f3c0858afd500000000904730440220626010de8205712edb16560410fb2e99c1c602aa25d77575471321c62c1b33e30220684ab1e4037e1b38c25fb1f175e07a54621ffca4e37659019dcfa1d7ac463b0e0147304402205f907d97d9b229ce660f4bf13382e04132e042d49d1ea043a3043ea76e4c6f710220177f69d1be52744c0f55b2be106575159efffd5c8d84ca85b2cb0741d022fbaa01ffffffff01706f9800000000001976a91454a752f0d71b89d7c014ed0be29ca231c9546f9f88ac00000000\", 1]}"

Loading…
Cancel
Save