Merge pull request #3391 from moneromooo-monero/tf-dev

add support for townforge (monero fork using randomx)
This commit is contained in:
xmrig
2023-12-27 23:13:54 +07:00
committed by GitHub
4 changed files with 44 additions and 1 deletions

View File

@ -54,6 +54,7 @@ static const CoinInfo coinInfo[] = {
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
{ Algorithm::RX_0, "ZEPH", "Zephyr", 120, 1000000000000, BLUE_BG_BOLD( WHITE_BOLD_S " zephyr ") },
{ Algorithm::RX_0, "Townforge","Townforge", 30, 100000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " townforge ") },
};

View File

@ -40,6 +40,7 @@ public:
RAVEN,
WOWNERO,
ZEPHYR,
TOWNFORGE,
MAX
};

View File

@ -207,7 +207,8 @@ bool xmrig::BlockTemplate::parse(bool hashes)
setOffset(MINER_TX_PREFIX_OFFSET, ar.index());
ar(m_txVersion);
ar(m_unlockTime);
if (m_coin != Coin::TOWNFORGE)
ar(m_unlockTime);
ar(m_numInputs);
// must be 1 input
@ -280,6 +281,9 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_viewTag);
}
if (m_coin == Coin::TOWNFORGE)
ar(m_unlockTime);
ar(m_extraSize);
setOffset(TX_EXTRA_OFFSET, ar.index());
@ -335,6 +339,10 @@ bool xmrig::BlockTemplate::parse(bool hashes)
uint8_t vin_rct_type = 0;
ar(vin_rct_type);
// no way I'm parsing a full game update here
if (m_coin == Coin::TOWNFORGE && m_height % 720 == 0)
return true;
// must be RCTTypeNull (0)
if (vin_rct_type != 0) {
return false;

View File

@ -33,6 +33,26 @@
bool xmrig::WalletAddress::decode(const char *address, size_t size)
{
uint64_t tf_tag = 0;
if (size >= 4 && !strncmp(address, "TF", 2))
{
tf_tag = 0x424200;
switch (address[2])
{
case '1': tf_tag |= 0; break;
case '2': tf_tag |= 1; break;
default: tf_tag = 0; return false;
}
switch (address[3]) {
case 'M': tf_tag |= 0; break;
case 'T': tf_tag |= 0x10; break;
case 'S': tf_tag |= 0x20; break;
default: tf_tag = 0; return false;
}
address += 4;
size -= 4;
}
static constexpr std::array<int, 9> block_sizes{ 0, 2, 3, 5, 6, 7, 9, 10, 11 };
static constexpr char alphabet[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
constexpr size_t alphabet_size = sizeof(alphabet) - 1;
@ -114,6 +134,9 @@ bool xmrig::WalletAddress::decode(const char *address, size_t size)
if (memcmp(m_checksum, md, sizeof(m_checksum)) == 0) {
m_data = { address, size };
if (tf_tag)
m_tag = tf_tag;
return true;
}
}
@ -228,6 +251,16 @@ const xmrig::WalletAddress::TagInfo &xmrig::WalletAddress::tagInfo(uint64_t tag)
{ 0x54, { Coin::GRAFT, TESTNET, PUBLIC, 28881, 28882 } },
{ 0x55, { Coin::GRAFT, TESTNET, INTEGRATED, 28881, 28882 } },
{ 0x70, { Coin::GRAFT, TESTNET, SUBADDRESS, 28881, 28882 } },
{ 0x424200, { Coin::TOWNFORGE, MAINNET, PUBLIC, 18881, 18882 } },
{ 0x424201, { Coin::TOWNFORGE, MAINNET, SUBADDRESS, 18881, 18882 } },
{ 0x424210, { Coin::TOWNFORGE, TESTNET, PUBLIC, 28881, 28882 } },
{ 0x424211, { Coin::TOWNFORGE, TESTNET, SUBADDRESS, 28881, 28882 } },
{ 0x424220, { Coin::TOWNFORGE, STAGENET, PUBLIC, 38881, 38882 } },
{ 0x424221, { Coin::TOWNFORGE, STAGENET, SUBADDRESS, 38881, 38882 } },
};
const auto it = tags.find(tag);