Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
722c92ba11
  1. 2
      basilisk/basilisk.c
  2. 7
      iguana/confs/BTCD_hdrs.txt
  3. 2
      iguana/iguana_payments.c
  4. 34
      iguana/iguana_sign.c
  5. 4
      iguana/iguana_tx.c
  6. 2
      iguana/tests/decoderawtransaction

2
basilisk/basilisk.c

@ -535,7 +535,7 @@ void basilisk_result(struct supernet_info *myinfo,char *remoteaddr,uint32_t basi
jaddi(pending->retarray,item); jaddi(pending->retarray,item);
} else printf("couldnt parse.(%s)\n",retstr); } else printf("couldnt parse.(%s)\n",retstr);
pending->numresults++; pending->numresults++;
} else printf("couldnt find issued.%u\n",basilisktag); } //else printf("couldnt find issued.%u\n",basilisktag);
} }
} }
} }

7
iguana/confs/BTCD_hdrs.txt

@ -1,4 +1,4 @@
1221510 1218010
0 0000044966f40703b516c5af180582d53f783bfd319bb045e2dc3e05ea695d46 a5d211145f8e6ba0920b2893d307c5d7c207ae0800a80955299678d1706ea8ac 000000000c4682089c916de89eb080a877566494d4009c0089baf35fe94de22f 0 0000044966f40703b516c5af180582d53f783bfd319bb045e2dc3e05ea695d46 a5d211145f8e6ba0920b2893d307c5d7c207ae0800a80955299678d1706ea8ac 000000000c4682089c916de89eb080a877566494d4009c0089baf35fe94de22f
500 000000000680a9a697eb71155b18a5827e0889fca28afb81fcbb46469ed7877e 79f80a8f54c6762d6408347c6dd7dfd2f8b8c191077c1d7881dfc5b7ec6a408e 0000000002b868fe717dc60b8d146de4d9aecf779b7314224908566e01847769 500 000000000680a9a697eb71155b18a5827e0889fca28afb81fcbb46469ed7877e 79f80a8f54c6762d6408347c6dd7dfd2f8b8c191077c1d7881dfc5b7ec6a408e 0000000002b868fe717dc60b8d146de4d9aecf779b7314224908566e01847769
1000 0000000000000cf908c887020f8970b7fe952f8b81164d83a87621dfdb581d08 3356ec4296ff2f04281492b0dedbaed80edeb6dd9170b87230ff79f6b0daade7 0000000000001e7c6d28962a03b3d75ffa1355ecc6d3021893b2727a1ccfc669 1000 0000000000000cf908c887020f8970b7fe952f8b81164d83a87621dfdb581d08 3356ec4296ff2f04281492b0dedbaed80edeb6dd9170b87230ff79f6b0daade7 0000000000001e7c6d28962a03b3d75ffa1355ecc6d3021893b2727a1ccfc669
@ -2435,7 +2435,4 @@
1216500 d9943902065c4b0823cd64a62d37b532c6d62d0ed1d8828927ac39089207b9ae c83f557b4e2cc04d4375f91003054dbca728cbd9626fa9e9420ecc77aeb70e6f 32fe72cc551ce71177df0895e2f384649fa4f137e4d6f7b6c93eec53d2eee53d 1216500 d9943902065c4b0823cd64a62d37b532c6d62d0ed1d8828927ac39089207b9ae c83f557b4e2cc04d4375f91003054dbca728cbd9626fa9e9420ecc77aeb70e6f 32fe72cc551ce71177df0895e2f384649fa4f137e4d6f7b6c93eec53d2eee53d
1217000 382d47307ca74e43ab3cf0152c65cdf01ea2348b1ea1b25113e6b5fdda458a34 835103782e04e0e8bd18c741ecd1a8238eee814973ab7ad40eebe58e2fffc100 5f1d7ac4471b7dbf2927f5a3dc7212cc025e8deb674f87559ae7bb80c81ba2c4 1217000 382d47307ca74e43ab3cf0152c65cdf01ea2348b1ea1b25113e6b5fdda458a34 835103782e04e0e8bd18c741ecd1a8238eee814973ab7ad40eebe58e2fffc100 5f1d7ac4471b7dbf2927f5a3dc7212cc025e8deb674f87559ae7bb80c81ba2c4
1217500 2e165b64031b2e689a8e6cf9b24f4a928d7f9de6777ce918aaaf99991562c603 84f608ddd07f0e6c7307570ad6ec5bb0b7361c779d1c18e8cb0c9e08a29cee0c 0ea9e4d3b33c19fbda78146bc486343b4717edf67573392742a697bbf34778ed 1217500 2e165b64031b2e689a8e6cf9b24f4a928d7f9de6777ce918aaaf99991562c603 84f608ddd07f0e6c7307570ad6ec5bb0b7361c779d1c18e8cb0c9e08a29cee0c 0ea9e4d3b33c19fbda78146bc486343b4717edf67573392742a697bbf34778ed
1218000 c62fb3c42177536ab92a97c2d8fc21f72ca1499aca8bc9b604d8265cd8630771 375f71108b5160a7a7990288ef3394cdcfcfcf77955f21f28368d101ba93eb66 b51ab010fef2ea591827977f896d80a4dd63cf94bded139805169c581849068f 1218000 c62fb3c42177536ab92a97c2d8fc21f72ca1499aca8bc9b604d8265cd8630771
1218500 a162e27d52028d27ace91149cd6526e41f6ac23e67378f81f51836f7326fed9d 28c6848464f675c93a357833cbd7af6fe0d1881723c9b1dfa731a7ee2c08536f 898dea8a454aa96a0931532a0eb7e181de7f83359f7433c520e4693b5fdf4948
1219000 fe267680bd06b3bf83536a78e7f41b7a389478c9b1e221deae145bf8a08d5b47 4466a5245e8e0c00d39be14b484771ebe4ac618cfaaae42c566a084ed3870da5 99adb8f4eb21b3a3b58279d7c08f50b18b854f9e52adb5c026bb50cd2c004818
1219500 ad07e8ef4af3453d3d595897cd7d9283361f64307bc92456b2a1f9060332eb66

2
iguana/iguana_payments.c

@ -969,7 +969,7 @@ char *iguana_validaterawtx(struct supernet_info *myinfo,struct iguana_info *coin
STRING_AND_INT(bitcoinrpc,validaterawtransaction,rawtx,suppress) STRING_AND_INT(bitcoinrpc,validaterawtransaction,rawtx,suppress)
{ {
uint8_t *extraspace; int32_t extralen=65536; char *retstr; struct iguana_msgtx msgtx; uint8_t *extraspace; int32_t extralen=65536;// char *retstr; struct iguana_msgtx msgtx;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));

34
iguana/iguana_sign.c

@ -45,12 +45,13 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
memcpy(&serialized[len],msg->vinscript,msg->scriptlen), len += msg->scriptlen; // pubkeys here memcpy(&serialized[len],msg->vinscript,msg->scriptlen), len += msg->scriptlen; // pubkeys here
if ( msg->userdatalen > 0 && msg->userdata != 0 ) if ( msg->userdatalen > 0 && msg->userdata != 0 )
{ {
printf("userdata.%d p2shlen %d %x scriptlen.%d\n",msg->userdatalen,msg->p2shlen,msg->p2shlen,msg->scriptlen); printf("userdata.%d scriptlen.%d\n",msg->userdatalen,msg->scriptlen);
memcpy(&serialized[len],msg->userdata,msg->userdatalen); memcpy(&serialized[len],msg->userdata,msg->userdatalen);
len += msg->userdatalen; len += msg->userdatalen;
} }
if ( (p2shlen= msg->p2shlen) > 0 && msg->redeemscript != 0 ) if ( (p2shlen= msg->p2shlen) > 0 && msg->redeemscript != 0 )
{ {
printf("p2shlen.%d %x\n",p2shlen,p2shlen);
if ( p2shlen < 76 ) if ( p2shlen < 76 )
serialized[len++] = p2shlen; serialized[len++] = p2shlen;
else if ( p2shlen <= 0xff ) else if ( p2shlen <= 0xff )
@ -73,7 +74,7 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
int32_t i; char str[65]; int32_t i; char str[65];
for (i=0; i<len; i++) for (i=0; i<len; i++)
printf("%02x",serialized[i]); printf("%02x",serialized[i]);
printf(" prev_hash.(%s) vout.%d [%p] scriptlen.%d rwflag.%d\n",bits256_str(str,msg->prev_hash),msg->prev_vout,msg->vinscript,msg->scriptlen,rwflag); printf(" %08x prev_hash.(%s) vout.%d [%p] scriptlen.%d rwflag.%d\n",msg->sequence,bits256_str(str,msg->prev_hash),msg->prev_vout,msg->vinscript,msg->scriptlen,rwflag);
} }
return(len); return(len);
} }
@ -197,29 +198,6 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
} }
} }
} }
/*tmp = need_op0; // for backward compatibility bitcoin multisig script bug
if ( hexstr != 0 )
tmp += (int32_t)strlen(hexstr) >> 1;
if ( suppress_pubkeys == 0 && (pubkeysjson= jarray(&n,vinobj,"pubkeys")) != 0 )
{
for (i=0; i<n; i++)
{
if ( (pubkeystr= jstr(jitem(pubkeysjson,i),0)) != 0 && (plen= (int32_t)strlen(pubkeystr) >> 1) > 0 )
tmp += (plen + 1);
}
}
if ( userdata != 0 )
tmp += (int32_t)strlen(userdata) >> 1;
if ( redeemstr != 0 )
{
n = (int32_t)strlen(redeemstr) >> 1;
tmp += n;
if ( n < 76 )
tmp++;
else if ( n <= 0xff )
tmp += 2;
else tmp += 3;
}*/
tmp = IGUANA_MAXSCRIPTSIZE; tmp = IGUANA_MAXSCRIPTSIZE;
len += iguana_rwvarint32(rwflag,&serialized[len],&tmp); len += iguana_rwvarint32(rwflag,&serialized[len],&tmp);
starti = len; starti = len;
@ -308,12 +286,12 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
printf(" <- offset.%d tmp.%d starti.%d\n",len,tmp,starti); printf(" <- offset.%d tmp.%d starti.%d\n",len,tmp,starti);
serialized[starti-2] = (tmp & 0xff); serialized[starti-2] = (tmp & 0xff);
serialized[starti-1] = ((tmp >> 8) & 0xff); serialized[starti-1] = ((tmp >> 8) & 0xff);
//printf("output sequence.[%d] <- %x\n",len,vin->sequence);
len += iguana_rwnum(rwflag,&serialized[len],sizeof(vin->sequence),&vin->sequence);
if ( spendstr != 0 ) if ( spendstr != 0 )
{ {
n = iguana_parsehexstr(&vin->spendscript,&vin->spendlen,V!=0?V->spendscript:0,V!=0?&V->spendlen:0,0,spendstr); n = iguana_parsehexstr(&vin->spendscript,&vin->spendlen,V!=0?V->spendscript:0,V!=0?&V->spendlen:0,0,spendstr);
} }
//printf("output sequence.[%d] <- %x\n",len,vin->sequence);
len += iguana_rwnum(rwflag,&serialized[len],sizeof(vin->sequence),&vin->sequence);
return(len); return(len);
} }
@ -856,7 +834,7 @@ int32_t bitcoin_verifyvins(struct iguana_info *coin,int32_t height,bits256 *sign
iguana_msgtx_Vset(coin,serialized,maxlen,msgtx,V); iguana_msgtx_Vset(coin,serialized,maxlen,msgtx,V);
cJSON *txobj = cJSON_CreateObject(); cJSON *txobj = cJSON_CreateObject();
*signedtx = iguana_rawtxbytes(coin,height,txobj,msgtx,suppress_pubkeys); *signedtx = iguana_rawtxbytes(coin,height,txobj,msgtx,suppress_pubkeys);
//printf("SIGNEDTX.(%s)\n",jprint(txobj,1)); printf("SIGNEDTX.(%s)\n",jprint(txobj,1));
*signedtxidp = msgtx->txid; *signedtxidp = msgtx->txid;
return(complete); return(complete);
} }

4
iguana/iguana_tx.c

@ -321,9 +321,9 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int
{ {
if ( coin->virtualchain != 0 ) if ( coin->virtualchain != 0 )
; ;
if ( block != 0 ) /*if ( block != 0 )
printf("iguana_peerblockrequest: block.%p ht.%d mainchain.%d [%d:%d] from %s bp.%p rdata.%p\n",block,block->height,block->mainchain,bp->hdrsi,bundlei,addr!=0?addr->ipaddr:"local",bp,bp!=0?rdata:0); printf("iguana_peerblockrequest: block.%p ht.%d mainchain.%d [%d:%d] from %s bp.%p rdata.%p\n",block,block->height,block->mainchain,bp->hdrsi,bundlei,addr!=0?addr->ipaddr:"local",bp,bp!=0?rdata:0);
else printf("iguana_peerblockrequest: block.%p [%d:%d]\n",block,bp->hdrsi,bundlei); else printf("iguana_peerblockrequest: block.%p [%d:%d]\n",block,bp->hdrsi,bundlei);*/
} }
} //else printf("iguana_peerblockrequest: cant find %s\n",bits256_str(str,hash2)); } //else printf("iguana_peerblockrequest: cant find %s\n",bits256_str(str,hash2));
return(-1); return(-1);

2
iguana/tests/decoderawtransaction

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000013c27395a713b382028919f267bad48253433441eedef0e2f4f15621a3859473f00000000d147304402207ecd423b55c1aa45a994c4eb4337ff0891692fbb69954a9ba024745a99c5272d02207cea696425feb5388153ab7f2608d66a66e4c95cfda2d44e98bc56e25994d3f701206efad760ee54b9b2e2a038a821ef9f950eb0e248545ac202c3e2074cd14f92cb004c6763041c60aa57b1752103175cf93574c31637b8c2d8acd5319e3cd23761b5e418d32c6bcb194972ba9273ac67a9142d75daf71325feaa593b8f30989e462892189914882102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac68ffffffff01c1480000000000001976a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac00000000\", 1]}" curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"decoderawtransaction\",\"params\":[\"0100000001fa410a6476e77c900a51f608a119ef0b89afc5d00e14e72fa57818a86b45de3700000000d2483045022100943fd4de4cf3a48234e698b3905887e9fe2ac2680cb86dc8e98cbd3f4c141c5e0220441e4735aafc558867c2bdc0f1c2ae8f0ca423c79a0b424fa61dd9e726f4fa460120acc0defe79d786f2bb0482e7548e5a9b3311f48725f743fae0f8d3425ce64a88004c6763041588aa57b1752102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac67a9143e23baa423d23cd2b31e0f0e5f604bea249de423882103a7b696908f77d69ec89887f8c4a0423b9e80b5974dc43301bd7d8abad07e1211ac68ffffffff014a560000000000001976a9143ef4734c1141725c095342095f6e0e7748b6c16588ac00000000\", 1]}"

Loading…
Cancel
Save