From e9c43e9e4030932ea974952bb5b62cd8ad499e50 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 Jul 2018 00:46:54 -1100 Subject: [PATCH] Prevent bid for nonexistent assetid --- src/cc/CCassetstx.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index 34da82b70..d3a887c06 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -198,12 +198,17 @@ std::string AssetTransfer(int64_t txfee,uint256 assetid,std::vector des std::string CreateBuyOffer(int64_t txfee,int64_t bidamount,uint256 assetid,int64_t pricetotal) { - CMutableTransaction mtx; CPubKey mypk; struct CCcontract_info *cp,C; + CMutableTransaction mtx; CPubKey mypk; struct CCcontract_info *cp,C; uint256 hashBlock; CTransaction vintx; if ( bidamount < 0 || pricetotal < 0 ) { fprintf(stderr,"negative bidamount %lld, pricetotal %lld\n",(long long)bidamount,(long long)pricetotal); return(0); } + if ( GetTransaction(assetid,vintx,hashBlock,false) == 0 ) + { + fprintf(stderr,"cant find assetid\n"); + return(0); + } cp = CCinit(&C,EVAL_ASSETS); if ( txfee == 0 ) txfee = 10000;