Test
This commit is contained in:
@@ -155,18 +155,23 @@ int32_t MarmaraGetbatontxid(std::vector<uint256> &creditloop,uint256 &batontxid,
|
|||||||
if ( MarmaraGetcreatetxid(createtxid,txid) == 0 )
|
if ( MarmaraGetcreatetxid(createtxid,txid) == 0 )
|
||||||
{
|
{
|
||||||
txid = createtxid;
|
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 )
|
while ( CCgetspenttxid(spenttxid,vini,height,txid,vout) == 0 )
|
||||||
{
|
{
|
||||||
creditloop.push_back(txid);
|
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++;
|
n++;
|
||||||
if ( (value= CCgettxout(spenttxid,vout,1)) > 0 )
|
if ( (value= CCgettxout(spenttxid,vout,1)) == 10000 )
|
||||||
{
|
{
|
||||||
batontxid = spenttxid;
|
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);
|
return(n);
|
||||||
}
|
}
|
||||||
|
else if ( value > 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"got false baton %s %.8f\n",batontxid.GetHex().c_str(),(double)value/COIN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
txid = spenttxid;
|
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"));
|
result.push_back(Pair("error",(char *)"cant automatic settle even maturity heights"));
|
||||||
return(result);
|
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;
|
remaining = refamount;
|
||||||
GetCCaddress(cp,myCCaddr,Mypubkey());
|
GetCCaddress(cp,myCCaddr,Mypubkey());
|
||||||
Getscriptaddress(batonCCaddr,batontx.vout[0].scriptPubKey);
|
Getscriptaddress(batonCCaddr,batontx.vout[0].scriptPubKey);
|
||||||
if ( strcmp(myCCaddr,batonCCaddr) == 0 )
|
if ( strcmp(myCCaddr,batonCCaddr) == 0 )
|
||||||
{
|
{
|
||||||
mtx.vin.push_back(CTxIn(batontxid,0,CScript()));
|
mtx.vin.push_back(CTxIn(batontxid,0,CScript()));
|
||||||
|
mtx.vin.push_back(CTxIn(creditloop[1],1,CScript())); // issuance marker
|
||||||
pubkeys.push_back(mypk);
|
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 )
|
if ( GetTransaction(creditloop[i],tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5583,6 +5583,8 @@ UniValue marmara_issue(const UniValue& params, bool fHelp)
|
|||||||
if ( fHelp || params.size() != 5 )
|
if ( fHelp || params.size() != 5 )
|
||||||
{
|
{
|
||||||
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 32da4cb3e886ee42de90b4a15042d71169077306badf909099c5c5c692df3f27
|
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 32da4cb3e886ee42de90b4a15042d71169077306badf909099c5c5c692df3f27
|
||||||
|
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 700 MARMARA 2629 11fe8bf1de80c2ef69124d08907f259aef7f41e3a632ca2d48ad072a8c8f3078 -> 335df3a5dd6b92a3d020c9465d4d76e0d8242126106b83756dcecbad9813fdf3
|
||||||
|
|
||||||
throw runtime_error("marmaraissue receiverpk amount currency matures approvaltxid\n");
|
throw runtime_error("marmaraissue receiverpk amount currency matures approvaltxid\n");
|
||||||
}
|
}
|
||||||
if ( ensure_CCrequirements() < 0 )
|
if ( ensure_CCrequirements() < 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user