jl777 9 years ago
parent
commit
373ac7bd49
  1. 9
      iguana/dpow/dpow_tx.c
  2. 6
      iguana/iguana_msg.c
  3. 6
      iguana/iguana_sign.c
  4. 2
      iguana/tests/decoderawtransaction

9
iguana/dpow/dpow_tx.c

@ -305,7 +305,7 @@ cJSON *dpow_vins(struct iguana_info *coin,struct dpow_block *bp,int8_t bestk,uin
vins = cJSON_CreateArray(); vins = cJSON_CreateArray();
for (j=0; j<bp->numnotaries; j++) for (j=0; j<bp->numnotaries; j++)
{ {
k = DPOW_MODIND(bp,j); k = j;//DPOW_MODIND(bp,j);
if ( ((1LL << k) & bestmask) != 0 ) if ( ((1LL << k) & bestmask) != 0 )
{ {
ep = &bp->notaries[k]; ep = &bp->notaries[k];
@ -341,7 +341,7 @@ cJSON *dpow_vins(struct iguana_info *coin,struct dpow_block *bp,int8_t bestk,uin
jaddi(vins,item); jaddi(vins,item);
//printf("height.%d mod.%d VINI.%d <- i.%d j.%d\n",height,height % numnotaries,m,i,j); //printf("height.%d mod.%d VINI.%d <- i.%d j.%d\n",height,height % numnotaries,m,i,j);
m++; m++;
if ( m == bp->minsigs && k == bestk ) if ( m == bp->minsigs )//&& k == bestk )
break; break;
} }
else else
@ -415,7 +415,7 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,useratified)) != 0 ) if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,useratified)) != 0 )
{ {
txid = dpow_notarytx(rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified*bp->numratified); txid = dpow_notarytx(rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified*bp->numratified);
char str[65]; printf("signedtxgen %s src_or_dest.%d (%d %llx) useratified.%d raw.(%s)\n",bits256_str(str,txid),src_or_dest,bestk,(long long)bestmask,useratified,rawtx); //char str[65]; printf("signedtxgen %s src_or_dest.%d (%d %llx) useratified.%d raw.(%s)\n",bits256_str(str,txid),src_or_dest,bestk,(long long)bestmask,useratified,rawtx);
if ( bits256_nonz(txid) != 0 && rawtx[0] != 0 ) // send tx to share utxo set if ( bits256_nonz(txid) != 0 && rawtx[0] != 0 ) // send tx to share utxo set
{ {
if ( useratified != 0 ) if ( useratified != 0 )
@ -424,15 +424,12 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
{ {
if ( (signobj= cJSON_Parse(jsonstr)) != 0 ) if ( (signobj= cJSON_Parse(jsonstr)) != 0 )
{ {
printf("signobj\n");
if ( ((signedtx= jstr(signobj,"hex")) != 0 || (signedtx= jstr(signobj,"result")) != 0) && (rawtx2= dpow_decoderawtransaction(myinfo,coin,signedtx)) != 0 ) if ( ((signedtx= jstr(signobj,"hex")) != 0 || (signedtx= jstr(signobj,"result")) != 0) && (rawtx2= dpow_decoderawtransaction(myinfo,coin,signedtx)) != 0 )
{ {
printf("rawtx2\n");
if ( (txobj2= cJSON_Parse(rawtx2)) != 0 ) if ( (txobj2= cJSON_Parse(rawtx2)) != 0 )
{ {
if ( (vin= jarray(&m,txobj2,"vin")) != 0 ) if ( (vin= jarray(&m,txobj2,"vin")) != 0 )
{ {
printf("vin[%d]\n",m);
for (j=0; j<m; j++) for (j=0; j<m; j++)
{ {
item = jitem(vin,j); item = jitem(vin,j);

6
iguana/iguana_msg.c

@ -659,9 +659,9 @@ int32_t iguana_rwtx(struct supernet_info *myinfo,uint8_t zcash,int32_t rwflag,st
return(-1); return(-1);
} }
} }
for (i=-3; i<7; i++) //for (i=-3; i<7; i++)
printf("%02x",serialized[len+i]); // printf("%02x",serialized[len+i]);
printf(" prev 3 bytes before tx_out\n"); //printf(" prev 3 bytes before tx_out\n");
len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out); len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out);
if ( len + msg->tx_out*8 > maxsize ) if ( len + msg->tx_out*8 > maxsize )
{ {

6
iguana/iguana_sign.c

@ -618,9 +618,9 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t height,int32_t rwflag,cJ
return(-1); return(-1);
} }
} }
for (i=-3; i<7; i++) //for (i=-3; i<7; i++)
printf("%02x",serialized[len+i]); // printf("%02x",serialized[len+i]);
printf(" prev 3 bytes before tx_out rw.%d\n",rwflag); //printf(" prev 3 bytes before tx_out rw.%d\n",rwflag);
len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out); len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out);
if ( rwflag == 0 ) if ( rwflag == 0 )
{ {

2
iguana/tests/decoderawtransaction

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save