disable token imports on LABS. fix getimports RPC
This commit is contained in:
@@ -535,6 +535,8 @@ bool CheckMigration(Eval *eval, const CTransaction &importTx, const CTransaction
|
|||||||
|
|
||||||
uint256 tokenid = zeroid;
|
uint256 tokenid = zeroid;
|
||||||
if (vimportOpret.begin()[0] == EVAL_TOKENS) { // for tokens (new opret with tokens)
|
if (vimportOpret.begin()[0] == EVAL_TOKENS) { // for tokens (new opret with tokens)
|
||||||
|
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 1 )
|
||||||
|
return eval->Invalid("no-tokens-migrate-on-LABS");
|
||||||
struct CCcontract_info *cpTokens, CCtokens_info;
|
struct CCcontract_info *cpTokens, CCtokens_info;
|
||||||
std::vector<std::pair<uint8_t, vscript_t>> oprets;
|
std::vector<std::pair<uint8_t, vscript_t>> oprets;
|
||||||
uint8_t evalCodeInOpret;
|
uint8_t evalCodeInOpret;
|
||||||
|
|||||||
@@ -301,6 +301,9 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp)
|
|||||||
if( params.size() == 4 )
|
if( params.size() == 4 )
|
||||||
tokenid = Parseuint256(params[3].get_str().c_str());
|
tokenid = Parseuint256(params[3].get_str().c_str());
|
||||||
|
|
||||||
|
if ( tokenid != zeroid && strcmp("LABS", targetSymbol.c_str()))
|
||||||
|
throw JSONRPCError(RPC_TYPE_ERROR, "There is no tokens support on LABS.");
|
||||||
|
|
||||||
CPubKey myPubKey = Mypubkey();
|
CPubKey myPubKey = Mypubkey();
|
||||||
struct CCcontract_info *cpTokens, C;
|
struct CCcontract_info *cpTokens, C;
|
||||||
cpTokens = CCinit(&C, EVAL_TOKENS);
|
cpTokens = CCinit(&C, EVAL_TOKENS);
|
||||||
@@ -312,8 +315,8 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
if (tokenid.IsNull()) { // coins
|
if (tokenid.IsNull()) { // coins
|
||||||
int64_t inputs;
|
int64_t inputs;
|
||||||
if ((inputs = AddNormalinputs(mtx, myPubKey, burnAmount + txfee, 60)) == 0) {
|
if ((inputs = AddNormalinputs(mtx, myPubKey, burnAmount + txfee, 10)) == 0) {
|
||||||
throw runtime_error("Cannot find normal inputs\n");
|
throw runtime_error("not enough funds, or need to merge utxos first\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CTxDestination txdest = DecodeDestination(dest_addr_or_pubkey.c_str());
|
CTxDestination txdest = DecodeDestination(dest_addr_or_pubkey.c_str());
|
||||||
@@ -1145,36 +1148,43 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp)
|
|||||||
//out.push_back(make_pair("blocktime",(int)));
|
//out.push_back(make_pair("blocktime",(int)));
|
||||||
UniValue labs(UniValue::VARR);
|
UniValue labs(UniValue::VARR);
|
||||||
UniValue kmd(UniValue::VARR);
|
UniValue kmd(UniValue::VARR);
|
||||||
// Gets KMD notaries on KMD... but LABS notaries on labs chains needs to be fixed so LABS are identified on KMD.
|
int8_t numNN = 0, numSN = 0; uint8_t notarypubkeys[64][33] = {0}; uint8_t LABSpubkeys[64][33] = {0};
|
||||||
int8_t numNN = 0; uint8_t notarypubkeys[64][33] = {0};
|
|
||||||
numNN = komodo_notaries(notarypubkeys, height, chainActive[height]->nTime);
|
numNN = komodo_notaries(notarypubkeys, height, chainActive[height]->nTime);
|
||||||
|
numSN = numStakedNotaries(LABSpubkeys,STAKED_era(chainActive[height]->nTime));
|
||||||
|
|
||||||
BOOST_FOREACH(const Notarisation& n, nibs)
|
BOOST_FOREACH(const Notarisation& n, nibs)
|
||||||
{
|
{
|
||||||
UniValue item(UniValue::VOBJ); UniValue notaryarr(UniValue::VARR); std::vector<int8_t> NotarisationNotaries;
|
UniValue item(UniValue::VOBJ); UniValue notaryarr(UniValue::VARR); std::vector<int8_t> NotarisationNotaries;
|
||||||
if ( is_STAKED(n.second.symbol) != 0 )
|
|
||||||
continue; // for now just skip this... need to fetch diff pubkeys for these chains. labs.push_back(item);
|
|
||||||
uint256 hash; CTransaction tx;
|
uint256 hash; CTransaction tx;
|
||||||
if ( GetTransaction(n.first,tx,hash,false) )
|
if ( GetTransaction(n.first,tx,hash,false) )
|
||||||
{
|
{
|
||||||
if ( !GetNotarisationNotaries(notarypubkeys, numNN, tx.vin, NotarisationNotaries) )
|
if ( is_STAKED(n.second.symbol) != 0 )
|
||||||
continue;
|
{
|
||||||
if ( NotarisationNotaries.size() < numNN/5 )
|
if ( !GetNotarisationNotaries(LABSpubkeys, numSN, tx.vin, NotarisationNotaries) )
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !GetNotarisationNotaries(notarypubkeys, numNN, tx.vin, NotarisationNotaries) )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
item.push_back(make_pair("txid", n.first.GetHex()));
|
item.push_back(make_pair("txid", n.first.GetHex()));
|
||||||
item.push_back(make_pair("chain", n.second.symbol));
|
item.push_back(make_pair("chain", n.second.symbol));
|
||||||
item.push_back(make_pair("height", (int)n.second.height));
|
item.push_back(make_pair("height", (int)n.second.height));
|
||||||
item.push_back(make_pair("blockhash", n.second.blockHash.GetHex()));
|
item.push_back(make_pair("blockhash", n.second.blockHash.GetHex()));
|
||||||
item.push_back(make_pair("KMD_height", height)); // for when timstamp input is used.
|
//item.push_back(make_pair("KMD_height", height)); // for when timstamp input is used.
|
||||||
|
|
||||||
for ( auto notary : NotarisationNotaries )
|
for ( auto notary : NotarisationNotaries )
|
||||||
notaryarr.push_back(notary);
|
notaryarr.push_back(notary);
|
||||||
item.push_back(make_pair("notaries",notaryarr));
|
item.push_back(make_pair("notaries",notaryarr));
|
||||||
kmd.push_back(item);
|
if ( is_STAKED(n.second.symbol) != 0 )
|
||||||
|
labs.push_back(item);
|
||||||
|
else
|
||||||
|
kmd.push_back(item);
|
||||||
}
|
}
|
||||||
out.push_back(make_pair("KMD", kmd));
|
out.push_back(make_pair("KMD", kmd));
|
||||||
//out.push_back(make_pair("LABS", labs));
|
out.push_back(make_pair("LABS", labs));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,7 +1318,7 @@ UniValue getimports(const UniValue& params, bool fHelp)
|
|||||||
UniValue objTx(UniValue::VOBJ);
|
UniValue objTx(UniValue::VOBJ);
|
||||||
objTx.push_back(Pair("txid",tx.GetHash().ToString()));
|
objTx.push_back(Pair("txid",tx.GetHash().ToString()));
|
||||||
ImportProof proof; CTransaction burnTx; std::vector<CTxOut> payouts; CTxDestination importaddress;
|
ImportProof proof; CTransaction burnTx; std::vector<CTxOut> payouts; CTxDestination importaddress;
|
||||||
TotalImported += tx.vout[1].nValue;
|
TotalImported += tx.vout[0].nValue; // were vouts swapped?
|
||||||
objTx.push_back(Pair("amount", ValueFromAmount(tx.vout[1].nValue)));
|
objTx.push_back(Pair("amount", ValueFromAmount(tx.vout[1].nValue)));
|
||||||
if (ExtractDestination(tx.vout[1].scriptPubKey, importaddress))
|
if (ExtractDestination(tx.vout[1].scriptPubKey, importaddress))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user