remove mutually exclusive constraint on selfimport

-ac_beam and -ac_coda cannot be active at the same time

Clusters can do import coin normally even with self-import chains.

-ac_import=KMD (any bitcoinprotocol coin) will make a side chain (not
implemented yet)

Theoretically -ac_beam or -ac_coda can work with side chain (not
implemented yet other than chain params)
This commit is contained in:
jl777
2019-01-01 23:34:31 -11:00
parent 4dbb9e832a
commit e090330823
6 changed files with 95 additions and 55 deletions

View File

@@ -38,11 +38,22 @@ CTransaction MakeImportCoinTransaction(const TxProof proof, const CTransaction b
}
CTxOut MakeBurnOutput(CAmount value, uint32_t targetCCid, std::string targetSymbol, const std::vector<CTxOut> payouts)
CTxOut MakeBurnOutput(CAmount value, uint32_t targetCCid, std::string targetSymbol, const std::vector<CTxOut> payouts,std::vector<uint8_t> rawproof)
{
std::vector<uint8_t> opret = E_MARSHAL(ss << VARINT(targetCCid);
ss << targetSymbol;
ss << SerializeHash(payouts));
std::vector<uint8_t> opret;
if ( targetCCid != 0xffffffff )
{
opret = E_MARSHAL(ss << VARINT(targetCCid);
ss << targetSymbol;
ss << SerializeHash(payouts));
}
else
{
opret = E_MARSHAL(ss << VARINT(targetCCid);
ss << targetSymbol;
ss << SerializeHash(payouts);
ss << rawproof);
}
return CTxOut(value, CScript() << OP_RETURN << opret);
}
@@ -60,14 +71,25 @@ bool UnmarshalImportTx(const CTransaction &importTx, TxProof &proof, CTransactio
}
bool UnmarshalBurnTx(const CTransaction &burnTx, std::string &targetSymbol, uint32_t *targetCCid, uint256 &payoutsHash)
bool UnmarshalBurnTx(const CTransaction &burnTx, std::string &targetSymbol, uint32_t *targetCCid, uint256 &payoutsHash,std::vector<uint8_t>&rawproof)
{
std::vector<uint8_t> burnOpret;
std::vector<uint8_t> burnOpret; uint32_t ccid = 0;
if (burnTx.vout.size() == 0) return false;
GetOpReturnData(burnTx.vout.back().scriptPubKey, burnOpret);
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
ss >> targetSymbol;
ss >> payoutsHash);
E_UNMARSHAL(burnOpret, ss >> VARINT(ccid));
if ( ccid != 0xffffffff )
{
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
ss >> targetSymbol;
ss >> payoutsHash);
}
else
{
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
ss >> targetSymbol;
ss >> payoutsHash;
ss >> rawproof);
}
}