Test
This commit is contained in:
@@ -67,7 +67,7 @@ bool ValidateAssetRemainder(uint64_t remaining_price,uint64_t remaining_nValue,u
|
||||
}
|
||||
if ( remaining_price != 0 )
|
||||
newunitprice = (remaining_nValue * COIN) / remaining_price;
|
||||
fprintf(stderr,"recvunitprice %llu >= %llu unitprice, new unitprice %llu\n",(long long)recvunitprice,(long long)unitprice,(long long)newunitprice);
|
||||
fprintf(stderr,"recvunitprice %.8f >= %.8f unitprice, new unitprice %llu\n",(double)recvunitprice/COIN,(double)unitprice/COIN,(double)newunitprice/COIN);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ bool SetAssetFillamounts(uint64_t &received_nValue,uint64_t &remaining_price,uin
|
||||
}
|
||||
remaining_price = (totalprice - paidprice);
|
||||
unitprice = (orig_nValue * COIN) / totalprice;
|
||||
if ( unitprice > 0 && (received_nValue= paidprice * unitprice) > 0 && received_nValue < orig_nValue )
|
||||
if ( unitprice > 0 && (received_nValue= (paidprice * unitprice)/COIN) > 0 && received_nValue < orig_nValue )
|
||||
{
|
||||
remaining_nValue = (orig_nValue - received_nValue);
|
||||
return(ValidateAssetRemainder(remaining_price,remaining_nValue,orig_nValue,received_nValue,paidprice,totalprice));
|
||||
|
||||
@@ -310,11 +310,11 @@ bool AssetValidate(Eval* eval,const CTransaction &tx,int32_t numvouts,uint8_t fu
|
||||
|
||||
bool ProcessAssets(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
||||
{
|
||||
static uint256 zero,prevtxid;
|
||||
CTransaction createTx; uint256 txid,assetid,assetid2,hashBlock; uint8_t funcid; int32_t i,n; uint64_t amount; std::vector<uint8_t> origpubkey;
|
||||
txid = ctx.GetHash();
|
||||
if ( txid == prevtxid )
|
||||
return(true);
|
||||
//static uint256 zero,prevtxid;
|
||||
CTransaction createTx; uint256 assetid,assetid2,hashBlock; uint8_t funcid; int32_t i,n; uint64_t amount; std::vector<uint8_t> origpubkey;
|
||||
//txid = ctx.GetHash();
|
||||
//if ( txid == prevtxid )
|
||||
// return(true);
|
||||
fprintf(stderr,"ProcessAssets\n");
|
||||
if ( paramsNull.size() != 0 ) // Don't expect params
|
||||
return eval->Invalid("Cannot have params");
|
||||
@@ -328,11 +328,11 @@ bool ProcessAssets(Eval* eval, std::vector<uint8_t> paramsNull,const CTransactio
|
||||
return eval->Invalid("cant find asset2 create txid");
|
||||
else if ( AssetValidate(eval,ctx,n,funcid,assetid,assetid2,amount,origpubkey) != 0 )
|
||||
{
|
||||
prevtxid = txid;
|
||||
fprintf(stderr,"AssetValidate passed\n");
|
||||
//prevtxid = txid;
|
||||
fprintf(stderr,"AssetValidate.(%c) passed\n",funcid);
|
||||
return(true);
|
||||
}
|
||||
fprintf(stderr,"AssetValidate failed\n");
|
||||
fprintf(stderr,"AssetValidate.(%c) failed\n",funcid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user