jl777 8 years ago
parent
commit
a127bf97d7
  1. 14
      iguana/dpow/dpow_tx.c
  2. 7
      iguana/iguana_msg.c
  3. 5
      iguana/iguana_sign.c
  4. 2
      iguana/tests/decoderawtransaction

14
iguana/dpow/dpow_tx.c

@ -165,14 +165,19 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info
int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified)
{
uint32_t locktime=0,numvouts; uint64_t satoshis,satoshisB; int32_t i,opretlen,len=0; uint8_t opret[1024],data[4096];
numvouts = 2 + (pubkeys != 0) * numratified;
len += iguana_rwvarint32(1,&serialized[len],&numvouts);
numvouts = 2;
if ( pubkeys == 0 || numratified <= 0 )
{
satoshis = DPOW_UTXOSIZE * m * .76;
if ( (satoshisB= DPOW_UTXOSIZE * m - 10000) < satoshis )
satoshis = satoshisB;
} else satoshis = DPOW_MINOUTPUT;
}
else
{
satoshis = DPOW_MINOUTPUT;
numvouts += numratified;
}
len += iguana_rwvarint32(1,&serialized[len],&numvouts);
len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis);
serialized[len++] = 35;
serialized[len++] = 33;
@ -226,6 +231,7 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow
len += iguana_rwnum(1,&serialized[len],sizeof(version),&version);
if ( isPoS != 0 )
len += iguana_rwnum(1,&serialized[len],sizeof(bp->timestamp),&bp->timestamp);
m = bp->minsigs;
len += iguana_rwvarint32(1,&serialized[len],(uint32_t *)&m);
for (j=m=0; j<bp->numnotaries; j++)
{
@ -444,7 +450,7 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
}
}
}
}
} else printf("signrawtransaction error\n");
} else dpow_rawtxsign(myinfo,dp,coin,bp,rawtx,vins,bestk,bestmask,myind,src_or_dest);
} else printf("signedtxgen zero txid or null rawtx\n");
free_json(vins);

7
iguana/iguana_msg.c

@ -659,10 +659,13 @@ int32_t iguana_rwtx(struct supernet_info *myinfo,uint8_t zcash,int32_t rwflag,st
return(-1);
}
}
for (i=-3; i<7; i++)
printf("%02x",serialized[len+i]);
printf(" prev 3 bytes before tx_out\n");
len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out);
if ( len + msg->tx_out*8 > maxsize )
{
printf("invalid tx_out.%d len.%d vs maxsize.%d\n",msg->tx_out,len,maxsize);
printf("invalidA tx_out.%d len.%d vs maxsize.%d\n",msg->tx_out,len,maxsize);
return(-1);
}
//printf("numvouts.%d ",msg->tx_out);
@ -674,7 +677,7 @@ int32_t iguana_rwtx(struct supernet_info *myinfo,uint8_t zcash,int32_t rwflag,st
len += n;
if ( n <= 0 || len > maxsize )
{
printf("invalid tx_out.%d len.%d vs maxsize.%d\n",msg->tx_out,len,maxsize);
printf("invalidB tx_out.%d len.%d vs maxsize.%d\n",msg->tx_out,len,maxsize);
return(-1);
}
}

5
iguana/iguana_sign.c

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

2
iguana/tests/decoderawtransaction

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