This commit is contained in:
jl777
2019-01-12 08:52:30 -11:00
parent 80c61ba505
commit c31f8ea3d5
2 changed files with 4 additions and 4 deletions

View File

@@ -124,6 +124,7 @@ uint8_t DecodeMaramaraCoinbaseOpRet(const CScript scriptPubKey,CPubKey &pk,int32
{
if ( E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> pk; ss >> height; ss >> unlockht) != 0 )
{
fprintf(stderr,"return %c\n",script[1]);
return(script[1]);
} else fprintf(stderr,"DecodeMaramaraCoinbaseOpRet unmarshal error for %c\n",script[1]);
} else fprintf(stderr,"script[1] is %d != 'C' %d or 'P' %d\n",script[1],'C','P');
@@ -245,7 +246,7 @@ int64_t AddMarmaraCoinbases(struct CCcontract_info *cp,CMutableTransaction &mtx,
fprintf(stderr,"txid.%s/v%d\n",txid.GetHex().c_str(),vout);
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
{
if ( vintx.IsCoinBase() != 0 )
if ( vintx.IsCoinBase() != 0 && vintx.vout.size() == 2 && vintx.vout[1].nValue == 0 )
{
if ( DecodeMaramaraCoinbaseOpRet(vintx.vout[1].scriptPubKey,pk,ht,unlockht) == 'C' && unlockht == unlocks && pk == poolpk )
{
@@ -259,7 +260,7 @@ int64_t AddMarmaraCoinbases(struct CCcontract_info *cp,CMutableTransaction &mtx,
if ( maxinputs > 0 && n >= maxinputs )
break;
} else fprintf(stderr,"nValue.%8f\n",(double)nValue/COIN);
} else fprintf(stderr,"decode error\n");
} else fprintf(stderr,"decode error unlockht.%d vs %d pk.%d\n",unlockht,unlocks,pk == poolpk);
} else fprintf(stderr,"not coinbase\n");
} else fprintf(stderr,"error getting tx\n");
}

View File

@@ -5536,7 +5536,7 @@ UniValue marmara_poolpayout(const UniValue& params, bool fHelp)
int32_t firstheight; double perc; char *jsonstr;
if ( fHelp || params.size() < 3 )
{
fprintf(stderr,"params.size %d\n",(int32_t)params.size());
// marmarapoolpayout "0.5" 2 '[["024131032ed90941e714db8e6dd176fe5a86c9d873d279edecf005c06f773da686",1000],["02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92",100]]';
throw runtime_error("marmara_poolpayout perc firstheight \"[[\\\"pubkey\\\":shares], ...]\"\n");
}
if ( ensure_CCrequirements() < 0 )
@@ -5544,7 +5544,6 @@ UniValue marmara_poolpayout(const UniValue& params, bool fHelp)
perc = atof(params[0].get_str().c_str()) / 100.;
firstheight = atol(params[1].get_str().c_str());
jsonstr = (char *)params[2].get_str().c_str();
fprintf(stderr,"perc %.8f ht.%d (%s)\n",perc,firstheight,jsonstr);
return(MarmaraPoolPayout(0,firstheight,perc,jsonstr)); // [[pk0, shares0], [pk1, shares1], ...]
}