This commit is contained in:
jl777
2018-07-26 00:36:53 -11:00
parent c272ff8636
commit 855ff4a174
2 changed files with 16 additions and 18 deletions

View File

@@ -228,7 +228,7 @@ bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
else
{
inputs = 0;
for (i=2; i<numvouts; i++)
for (i=2; i<numvouts-1; i++)
{
if ((assetoshis= IsAssetvout(tmpprice,tmporigpubkey,tx,i,assetid)) != 0 && ConstrainVout(tx.vout[i],1,CCaddr,0) == assetoshis )
inputs += assetoshis;
@@ -296,7 +296,7 @@ bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
else
{
inputs = 0;
for (i=2; i<numvouts; i++)
for (i=2; i<numvouts-1; i++)
{
if ( (nValue= ConstrainVout(tx.vout[i],0,origaddr,0)) != 0 )
inputs += nValue;
@@ -341,13 +341,11 @@ bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
else
{
inputs = 0;
for (i=2; i<numvouts; i++)
for (i=2; i<numvouts-1; i++)
{
if ( (assetoshis= IsAssetvout(tmpprice,tmporigpubkey,tx,i,assetid)) != 0 && ConstrainVout(tx.vout[i],1,CCaddr,0) == assetoshis )
inputs += assetoshis;
}
//ValidateAssetRemainder: orig_nValue == 10 || received_nValue == 0 || paidunits == 10 || totalunits == 100000000000
//bool ValidateAssetRemainder(int32_t sellflag,uint64_t remaining_price,uint64_t remaining_nValue,uint64_t orig_nValue,uint64_t received_nValue,uint64_t paidunits,uint64_t totalunits)
fprintf(stderr,"assets vout0 %llu, vin1 %llu, vout2 %llu -> orig, vout1 %llu, total %llu\n",(long long)tx.vout[0].nValue,(long long)assetoshis,(long long)tx.vout[2].nValue,(long long)tx.vout[1].nValue,(long long)totalunits);
if ( ValidateSwapRemainder(remaining_price,tx.vout[0].nValue,assetoshis,tx.vout[2].nValue,tx.vout[1].nValue,totalunits) == false )
return eval->Invalid("mismatched remainder for fill");