Baton address

This commit is contained in:
jl777
2019-01-15 00:58:49 -11:00
parent 41ed37e969
commit f03daaf2eb

View File

@@ -548,38 +548,63 @@ UniValue MarmaraIssue(uint64_t txfee,uint8_t funcid,CPubKey receiverpk,int64_t a
UniValue MarmaraCreditloop(uint256 txid)
{
UniValue result(UniValue::VOBJ),a(UniValue::VARR); std::vector<uint256> creditloop; uint256 batontxid,createtxid,hashBlock; uint8_t funcid; int32_t i,n,numvouts,matures; int64_t amount; CPubKey senderpk; std::string currency; CTransaction tx;
UniValue result(UniValue::VOBJ),a(UniValue::VARR); std::vector<uint256> creditloop; uint256 batontxid,createtxid,refcreatetxid,hashBlock; uint8_t funcid; int32_t i,n,numvouts,matures,refmatures; int64_t amount,refamount; CPubKey senderpk; std::string currency,refcurrency; CTransaction tx; char batonaddr[64];
if ( (n= MarmaraGetbatontxid(creditloop,batontxid,txid)) > 0 )
{
for (i=0; i<n; i++)
if ( GetTransaction(batontxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
{
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
result.push_back(Pair("result",(char *)"success"));
result.push_back(Pair("batontxid",batontxid.GetHex()));
if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,refcreatetxid,senderpk,refamount,refmatures,refcurrency)) != 0 )
{
if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,createtxid,senderpk,amount,matures,currency)) != 0 )
obj.push_back(Pair("funcid",funcid));
obj.push_back(Pair("createtxid",createtxid.GetHex()));
obj.push_back(Pair("amount",ValueFromAmount(amount)));
obj.push_back(Pair("matures",matures));
obj.push_back(Pair("currency",currency));
GetScriptaddr(batonaddr,tx.vout[0].scriptPubKey);
obj.push_back(Pair("batonaddress",batonaddr));
for (i=0; i<n; i++)
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("txid",txid.GetHex()));
obj.push_back(Pair("funcid",funcid));
obj.push_back(Pair("createtxid",createtxid.GetHex()));
obj.push_back(Pair("senderpk",HexStr(senderpk)));
obj.push_back(Pair("amount",ValueFromAmount(amount)));
obj.push_back(Pair("matures",matures));
obj.push_back(Pair("currency",currency));
a.push_back(obj);
if ( GetTransaction(creditloop[i],tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
{
if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,createtxid,senderpk,amount,matures,currency)) != 0 )
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("txid",txid.GetHex()));
obj.push_back(Pair("funcid",funcid));
obj.push_back(Pair("senderpk",HexStr(senderpk)));
a.push_back(obj);
}
}
}
result.push_back(Pair("n",n));
result.push_back(Pair("creditloop",a));
}
else
{
result.push_back(Pair("result",(char *)"error"));
result.push_back(Pair("error",(char *)"couldnt get batontxid opret"));
}
}
result.push_back(Pair("result",(char *)"success"));
result.push_back(Pair("n",n));
result.push_back(Pair("creditloop",a));
else
{
result.push_back(Pair("result",(char *)"error"));
result.push_back(Pair("error",(char *)"couldnt find batontxid"));
}
}
else
{
result.push_back(Pair("result",(char *)"error"));
result.push_back(Pair("error",(char *)"couldnt get creditloop"));
}
return(result);
}
UniValue MarmaraInfo(CPubKey refpk,int32_t firstheight,int32_t lastheight,int64_t minamount,int64_t maxamount,std::string currency)
{
UniValue result(UniValue::VOBJ),a(UniValue::VARR); int32_t i,n,matches; int64_t totalamount=0; std::vector<uint256> issuances;
{ UniValue result(UniValue::VOBJ),a(UniValue::VARR); int32_t i,n,matches; int64_t totalamount=0; std::vector<uint256> issuances;
CPubKey Marmarapk; struct CCcontract_info *cp,C;
result.push_back(Pair("result","success"));
if ( refpk.size() == 33 )