Komod-tx functions
This commit is contained in:
@@ -429,6 +429,12 @@ int64_t AddChannelsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx, C
|
|||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t komodo_nextheight()
|
||||||
|
{
|
||||||
|
return(100000000);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ChannelOpen(uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment)
|
std::string ChannelOpen(uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment)
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
|
|||||||
@@ -177,6 +177,31 @@ static void RegisterLoad(const std::string& strInput)
|
|||||||
RegisterSetJson(key, valStr);
|
RegisterSetJson(key, valStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set default values of new CMutableTransaction based on consensus rules at given height.
|
||||||
|
CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight)
|
||||||
|
{
|
||||||
|
CMutableTransaction mtx;
|
||||||
|
|
||||||
|
bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
|
||||||
|
if (isOverwintered) {
|
||||||
|
mtx.fOverwintered = true;
|
||||||
|
mtx.nExpiryHeight = nHeight + 60;
|
||||||
|
|
||||||
|
if (NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING)) {
|
||||||
|
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
|
||||||
|
mtx.nVersion = SAPLING_TX_VERSION;
|
||||||
|
} else {
|
||||||
|
mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID;
|
||||||
|
mtx.nVersion = OVERWINTER_TX_VERSION;
|
||||||
|
mtx.nExpiryHeight = std::min(
|
||||||
|
mtx.nExpiryHeight,
|
||||||
|
static_cast<uint32_t>(consensusParams.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mtx;
|
||||||
|
}
|
||||||
|
|
||||||
static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
|
static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
|
||||||
{
|
{
|
||||||
int64_t newVersion = atoi64(cmdVal);
|
int64_t newVersion = atoi64(cmdVal);
|
||||||
|
|||||||
Reference in New Issue
Block a user