diff --git a/src/cc/channels.cpp b/src/cc/channels.cpp index 9269096cc..4ee2d73e1 100644 --- a/src/cc/channels.cpp +++ b/src/cc/channels.cpp @@ -811,4 +811,4 @@ UniValue ChannelsInfo(uint256 channeltxid) result.push_back(Pair("Error","Channel not found!")); } return(result); -} \ No newline at end of file +} diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index 3165023e0..b1b478972 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -177,6 +177,37 @@ static void RegisterLoad(const std::string& strInput) RegisterSetJson(key, valStr); } + +int32_t komodo_nextheight() +{ + return(100000000); +} + + +// 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(consensusParams.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight - 1)); + } + } + return mtx; +} + static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal) { int64_t newVersion = atoi64(cmdVal);