Skip to content

Commit a51125f

Browse files
committed
Adding Zawy LWMA2
1 parent e9c1a02 commit a51125f

File tree

3 files changed

+454
-0
lines changed

3 files changed

+454
-0
lines changed

configs/bytecoin-v2/forknote.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"versionized-parameters.json",
1616
"zawy-difficulty-algorithm.json",
1717
"zawy-lwma-difficulty-algorithm.json",
18+
"zawy-lwma2-difficulty-algorithm.json",
1819
"bugged-zawy-difficulty-algorithm.json",
1920
"cryptonight-v7.json",
2021
"block-hosts.json",
@@ -34,6 +35,7 @@
3435
"multiply/versionized-parameters.json",
3536
"multiply/zawy-difficulty-algorithm.json",
3637
"multiply/zawy-lwma-difficulty-algorithm.json",
38+
"multiply/zawy-lwma2-difficulty-algorithm.json",
3739
"multiply/bugged-zawy-difficulty-algorithm.json",
3840
"multiply/cryptonight-v7.json",
3941
"daemon-getrandom_outs-json.json",
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
{
2+
"file": "multiply/zawy-lwma2-difficulty-algorithm.json",
3+
"description": "Add Zawy LWMA2 difficulty algorithm option in multiply (https://github.com/zawy12/difficulty-algorithms/issues/3)",
4+
"required": [
5+
"core/bytecoin.json",
6+
"zawy-lwma2-difficulty-algorithm.json",
7+
"multiply.json",
8+
"get-blockchain-settings.json"
9+
],
10+
"files": [
11+
{
12+
"path": "/src/Daemon/Daemon.cpp",
13+
"changes": [
14+
{
15+
"action": "add_below",
16+
"marker": "const command_line::arg_descriptor< std::vector<std::string> > arg_CHECKPOINT",
17+
"parameters": {
18+
"text": [
19+
" const command_line::arg_descriptor<uint32_t> arg_ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX = {\"ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX\", \"uint32_t\", 0};",
20+
" const command_line::arg_descriptor<uint32_t> arg_ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK = {\"ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK\", \"uint32_t\", 0};",
21+
" const command_line::arg_descriptor<uint64_t> arg_ZAWY_LWMA2_DIFFICULTY_MIN = {\"ZAWY_LWMA2_DIFFICULTY_MIN\", \"uint64_t\", 1};",
22+
" const command_line::arg_descriptor<size_t> arg_ZAWY_LWMA2_DIFFICULTY_N = {\"ZAWY_LWMA2_DIFFICULTY_N\", \"size_t\", 0};"
23+
]
24+
}
25+
},
26+
{
27+
"action": "add_below",
28+
"marker": "command_line::add_arg(desc_cmd_sett, arg_CHECKPOINT);",
29+
"parameters": {
30+
"text": [
31+
" command_line::add_arg(desc_cmd_sett, arg_ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX);",
32+
" command_line::add_arg(desc_cmd_sett, arg_ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK);",
33+
" command_line::add_arg(desc_cmd_sett, arg_ZAWY_LWMA2_DIFFICULTY_MIN);",
34+
" command_line::add_arg(desc_cmd_sett, arg_ZAWY_LWMA2_DIFFICULTY_N);"
35+
]
36+
}
37+
},
38+
{
39+
"action": "add_above",
40+
"marker": "currencyBuilder.testnet(testnet_mode);",
41+
"parameters": {
42+
"text": [
43+
" currencyBuilder.zawyLWMA2DifficultyBlockIndex(command_line::get_arg(vm, arg_ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX));",
44+
" currencyBuilder.zawyLWMA2DifficultyLastBlock(command_line::get_arg(vm, arg_ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK));",
45+
" currencyBuilder.zawyLWMA2DifficultyMin(command_line::get_arg(vm, arg_ZAWY_LWMA2_DIFFICULTY_MIN));",
46+
" currencyBuilder.zawyLWMA2DifficultyN(command_line::get_arg(vm, arg_ZAWY_LWMA2_DIFFICULTY_N));"
47+
]
48+
}
49+
}
50+
]
51+
},
52+
{
53+
"path": "/src/PaymentGateService/CoinBaseConfiguration.h",
54+
"changes": [
55+
{
56+
"action": "add_below",
57+
"marker": "uint64_t MONEY_SUPPLY;",
58+
"parameters": {
59+
"text": [
60+
" uint32_t ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX;",
61+
" uint32_t ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK;",
62+
" uint64_t ZAWY_LWMA2_DIFFICULTY_MIN;",
63+
" size_t ZAWY_LWMA2_DIFFICULTY_N;"
64+
]
65+
}
66+
}
67+
]
68+
},
69+
{
70+
"path": "/src/PaymentGateService/CoinBaseConfiguration.cpp",
71+
"changes": [
72+
{
73+
"action": "add_below",
74+
"marker": "MONEY_SUPPLY=CryptoNote::parameters::MONEY_SUPPLY;",
75+
"parameters": {
76+
"text": [
77+
" ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX=CryptoNote::parameters::ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX;",
78+
" ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK=CryptoNote::parameters::ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK;",
79+
" ZAWY_LWMA2_DIFFICULTY_MIN=CryptoNote::parameters::ZAWY_LWMA2_DIFFICULTY_MIN;",
80+
" ZAWY_LWMA2_DIFFICULTY_N=CryptoNote::parameters::ZAWY_LWMA2_DIFFICULTY_N;"
81+
]
82+
}
83+
},
84+
{
85+
"action": "add_below",
86+
"marker": "(\"MONEY_SUPPLY\", po::value<uint64_t>()->default_value(CryptoNote::parameters::MONEY_SUPPLY), \"uint64_t\")",
87+
"parameters": {
88+
"text": [
89+
" (\"ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX\", po::value<uint32_t>()->default_value(0), \"uint32_t\")",
90+
" (\"ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK\", po::value<uint32_t>()->default_value(0), \"uint32_t\")",
91+
" (\"ZAWY_LWMA2_DIFFICULTY_MIN\", po::value<uint64_t>()->default_value(1), \"uint64_t\")",
92+
" (\"ZAWY_LWMA2_DIFFICULTY_N\", po::value<size_t>()->default_value(0), \"size_t\")"
93+
]
94+
}
95+
},
96+
{
97+
"action": "add_above",
98+
"marker": "if (options.count(\"EMISSION_SPEED_FACTOR\")) {",
99+
"parameters": {
100+
"text": [
101+
" if (options.count(\"ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX\")) {",
102+
" ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX = options[\"ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX\"].as<uint32_t>();",
103+
" }",
104+
" if (options.count(\"ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK\")) {",
105+
" ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK = options[\"ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK\"].as<uint32_t>();",
106+
" }",
107+
" if (options.count(\"ZAWY_LWMA2_DIFFICULTY_MIN\")) {",
108+
" ZAWY_LWMA2_DIFFICULTY_MIN = options[\"ZAWY_LWMA2_DIFFICULTY_MIN\"].as<uint64_t>();",
109+
" }",
110+
" if (options.count(\"ZAWY_LWMA2_DIFFICULTY_N\")) {",
111+
" ZAWY_LWMA2_DIFFICULTY_N = options[\"ZAWY_LWMA2_DIFFICULTY_N\"].as<size_t>();",
112+
" }"
113+
]
114+
}
115+
}
116+
]
117+
},
118+
{
119+
"path": "/src/PaymentGateService/PaymentGateService.cpp",
120+
"changes": [
121+
{
122+
"action": "add_below",
123+
"marker": "currencyBuilder.moneySupply(config.coinBaseConfig.MONEY_SUPPLY);",
124+
"parameters": {
125+
"text": [
126+
" currencyBuilder.zawyLWMA2DifficultyBlockIndex(config.coinBaseConfig.ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX);",
127+
" currencyBuilder.zawyLWMA2DifficultyLastBlock(config.coinBaseConfig.ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK);",
128+
" currencyBuilder.zawyLWMA2DifficultyMin(config.coinBaseConfig.ZAWY_LWMA2_DIFFICULTY_MIN);",
129+
" currencyBuilder.zawyLWMA2DifficultyN(config.coinBaseConfig.ZAWY_LWMA2_DIFFICULTY_N);"
130+
]
131+
}
132+
}
133+
]
134+
},
135+
136+
{
137+
"path": "/src/Rpc/CoreRpcServerCommandsDefinitions.h",
138+
"description": "Changes for get-blockchain-settings.json",
139+
"changes": [
140+
{
141+
"action": "add_above",
142+
"marker": "std::string BYTECOIN_NETWORK;",
143+
"parameters": {
144+
"text": [
145+
" uint32_t ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX;",
146+
" uint32_t ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK;",
147+
" uint64_t ZAWY_LWMA2_DIFFICULTY_MIN;",
148+
" size_t ZAWY_LWMA2_DIFFICULTY_N;"
149+
]
150+
}
151+
},
152+
{
153+
"action": "add_above",
154+
"marker": "KV_MEMBER(BYTECOIN_NETWORK)",
155+
"parameters": {
156+
"text": [
157+
" KV_MEMBER(ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX)",
158+
" KV_MEMBER(ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK)",
159+
" KV_MEMBER(ZAWY_LWMA2_DIFFICULTY_MIN)",
160+
" KV_MEMBER(ZAWY_LWMA2_DIFFICULTY_N)"
161+
]
162+
}
163+
}
164+
]
165+
},
166+
{
167+
"path": "/src/Rpc/RpcServer.cpp",
168+
"description": "Changes for get-blockchain-settings.json",
169+
"changes": [
170+
{
171+
"action": "add_above",
172+
"marker": "res.core.CRYPTONOTE_NAME = m_core.getCurrency().cryptonoteName();",
173+
"parameters": {
174+
"text": [
175+
" if (m_core.getCurrency().zawyLWMA2DifficultyBlockIndex() != 0 ) {",
176+
" res.extensions.push_back(\"zawy-lwma2-difficulty-algorithm.json\");",
177+
" }"
178+
]
179+
}
180+
},
181+
{
182+
"action": "add_above",
183+
"marker": "res.core.P2P_DEFAULT_PORT = m_p2p.get_this_peer_port();",
184+
"parameters": {
185+
"text": [
186+
" res.core.ZAWY_LWMA2_DIFFICULTY_BLOCK_INDEX = m_core.getCurrency().zawyLWMA2DifficultyBlockIndex();",
187+
" res.core.ZAWY_LWMA2_DIFFICULTY_LAST_BLOCK = m_core.getCurrency().zawyLWMA2DifficultyLastBlock();",
188+
" res.core.ZAWY_LWMA2_DIFFICULTY_MIN = m_core.getCurrency().zawyLWMA2DifficultyMin();",
189+
" res.core.ZAWY_LWMA2_DIFFICULTY_N = m_core.getCurrency().zawyLWMA2DifficultyN();"
190+
]
191+
}
192+
}
193+
]
194+
}
195+
]
196+
}

0 commit comments

Comments
 (0)