diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index 62ce31570..2683a13c0 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -314,6 +314,9 @@ std::string FillSell(uint64_t txfee,uint256 assetid,uint256 assetid2,uint256 ask else inputs = AddNormalinputs(mtx,mypk,fillamount,60); if ( inputs > 0 ) { + if ( inputs < fillamount ) + fillamount = inputs; + fprintf(stderr,"inputs %llu, fillamount.%llu\n",(long long)inputs,(long long)fillamount); SetAssetFillamounts(1,paid_amount,remaining_required,askamount,fillamount,totalunits); if ( assetid2 != zeroid && inputs > fillamount ) CCchange = (inputs - fillamount); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 16df9128f..dcce4324e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5323,7 +5323,7 @@ UniValue tokenfillask(const UniValue& params, bool fHelp) throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); tokenid = Parseuint256((char *)params[0].get_str().c_str()); asktxid = Parseuint256((char *)params[1].get_str().c_str()); - fillamount = atol(params[2].get_str().c_str()); + fillamount = atof(params[2].get_str().c_str()) * COIN; hex = FillSell(0,tokenid,zeroid,asktxid,fillamount); if ( hex.size() > 0 ) {