This commit is contained in:
jl777
2019-01-16 22:46:45 -11:00
parent 5415bbed42
commit 8099e3af55
2 changed files with 19 additions and 6 deletions

View File

@@ -155,18 +155,23 @@ int32_t MarmaraGetbatontxid(std::vector<uint256> &creditloop,uint256 &batontxid,
if ( MarmaraGetcreatetxid(createtxid,txid) == 0 )
{
txid = createtxid;
fprintf(stderr,"txid.%s -> createtxid %s\n",txid.GetHex().c_str(),createtxid.GetHex().c_str());
//fprintf(stderr,"txid.%s -> createtxid %s\n",txid.GetHex().c_str(),createtxid.GetHex().c_str());
while ( CCgetspenttxid(spenttxid,vini,height,txid,vout) == 0 )
{
creditloop.push_back(txid);
fprintf(stderr,"%d: %s\n",n,txid.GetHex().c_str());
//fprintf(stderr,"%d: %s\n",n,txid.GetHex().c_str());
n++;
if ( (value= CCgettxout(spenttxid,vout,1)) > 0 )
if ( (value= CCgettxout(spenttxid,vout,1)) == 10000 )
{
batontxid = spenttxid;
fprintf(stderr,"got baton %s %.8f\n",batontxid.GetHex().c_str(),(double)value/COIN);
//fprintf(stderr,"got baton %s %.8f\n",batontxid.GetHex().c_str(),(double)value/COIN);
return(n);
}
else if ( value > 0 )
{
fprintf(stderr,"got false baton %s %.8f\n",batontxid.GetHex().c_str(),(double)value/COIN);
break;
}
txid = spenttxid;
}
}
@@ -417,15 +422,21 @@ UniValue MarmaraSettlement(uint64_t txfee,uint256 refbatontxid)
result.push_back(Pair("error",(char *)"cant automatic settle even maturity heights"));
return(result);
}
fprintf(stderr,"refmatures.%d\n",refmatures);
else if ( n < 2 )
{
result.push_back(Pair("result",(char *)"error"));
result.push_back(Pair("error",(char *)"creditloop too short"));
return(result);
}
remaining = refamount;
GetCCaddress(cp,myCCaddr,Mypubkey());
Getscriptaddress(batonCCaddr,batontx.vout[0].scriptPubKey);
if ( strcmp(myCCaddr,batonCCaddr) == 0 )
{
mtx.vin.push_back(CTxIn(batontxid,0,CScript()));
mtx.vin.push_back(CTxIn(creditloop[1],1,CScript())); // issuance marker
pubkeys.push_back(mypk);
for (i=0; i<n; i++)
for (i=1; i<n; i++)
{
if ( GetTransaction(creditloop[i],tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
{

View File

@@ -5583,6 +5583,8 @@ UniValue marmara_issue(const UniValue& params, bool fHelp)
if ( fHelp || params.size() != 5 )
{
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 32da4cb3e886ee42de90b4a15042d71169077306badf909099c5c5c692df3f27
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 700 MARMARA 2629 11fe8bf1de80c2ef69124d08907f259aef7f41e3a632ca2d48ad072a8c8f3078 -> 335df3a5dd6b92a3d020c9465d4d76e0d8242126106b83756dcecbad9813fdf3
throw runtime_error("marmaraissue receiverpk amount currency matures approvaltxid\n");
}
if ( ensure_CCrequirements() < 0 )