Adjust pool fee disp by three

This commit is contained in:
jl777
2019-01-12 16:04:43 -11:00
parent ab06776542
commit 26bef04f61

View File

@@ -298,7 +298,7 @@ UniValue MarmaraInfo()
UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,char *jsonstr) // [[pk0, shares0], [pk1, shares1], ...] UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,char *jsonstr) // [[pk0, shares0], [pk1, shares1], ...]
{ {
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
UniValue result(UniValue::VOBJ),a(UniValue::VARR); cJSON *item,*array; std::string rawtx; int32_t i,n; uint8_t buf[33]; CPubKey Marmarapk,pk,poolpk; int64_t payout,total,totalpayout=0; double poolshares,share,shares = 0.; char *pkstr,*errorstr=0; struct CCcontract_info *cp,C; UniValue result(UniValue::VOBJ),a(UniValue::VARR); cJSON *item,*array; std::string rawtx; int32_t i,n; uint8_t buf[33]; CPubKey Marmarapk,pk,poolpk; int64_t payout,poolfee=0,total,totalpayout=0; double poolshares,share,shares = 0.; char *pkstr,*errorstr=0; struct CCcontract_info *cp,C;
poolpk = pubkey2pk(Mypubkey()); poolpk = pubkey2pk(Mypubkey());
if ( txfee == 0 ) if ( txfee == 0 )
txfee = 10000; txfee = 10000;
@@ -344,7 +344,8 @@ UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,char *
} }
if ( totalpayout > 0 && total > totalpayout-txfee ) if ( totalpayout > 0 && total > totalpayout-txfee )
{ {
mtx.vout.push_back(MakeCC1of2vout(EVAL_MARMARA,total - totalpayout - txfee,Marmarapk,poolpk)); poolfee = (total - totalpayout - txfee);
mtx.vout.push_back(MakeCC1of2vout(EVAL_MARMARA,poolfee,Marmarapk,poolpk));
} }
rawtx = FinalizeCCTx(0,cp,mtx,poolpk,txfee,MarmaraCoinbaseOpret('P',firstheight,poolpk)); rawtx = FinalizeCCTx(0,cp,mtx,poolpk,txfee,MarmaraCoinbaseOpret('P',firstheight,poolpk));
if ( rawtx.size() == 0 ) if ( rawtx.size() == 0 )
@@ -372,8 +373,8 @@ UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,char *
result.push_back(Pair("total",(double)total/COIN)); result.push_back(Pair("total",(double)total/COIN));
result.push_back(Pair("totalpayout",(double)totalpayout/COIN)); result.push_back(Pair("totalpayout",(double)totalpayout/COIN));
result.push_back(Pair("totalshares",shares)); result.push_back(Pair("totalshares",shares));
result.push_back(Pair("poolfee",(double)(total - totalpayout)/COIN)); result.push_back(Pair("poolfee",(double)poolfee/COIN));
result.push_back(Pair("perc",100. * (double)(total - totalpayout)/totalpayout)); result.push_back(Pair("perc",100. * (double)poolfee/totalpayout));
result.push_back(Pair("payouts",a)); result.push_back(Pair("payouts",a));
} }
} }