Skip to content

Commit 531df9e

Browse files
authored
Merge pull request #2551 from jamescowens/kermits_mom_hardfork
consensus, rpc: Kermit's mom hardfork (2671700)
2 parents 81cd696 + a3995a6 commit 531df9e

File tree

8 files changed

+108
-15
lines changed

8 files changed

+108
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
run: |
4747
./ci/test_run_all.sh
4848
test-macos:
49-
name: macOS 10.15 native [GOAL install] [GUI] [no depends]
50-
runs-on: macos-10.15
49+
name: macOS 11 native [GOAL install] [GUI] [no depends]
50+
runs-on: macos-11
5151
env:
5252
DANGER_RUN_CI_ON_HOST: true
5353
CI_USE_APT_INSTALL: no

src/chainparams.cpp

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ class CMainParams : public CChainParams {
6565
consensus.BlockV9TallyHeight = 1144120;
6666
consensus.BlockV10Height = 1420000;
6767
consensus.BlockV11Height = 2053000;
68-
consensus.BlockV12Height = std::numeric_limits<int>::max();
69-
consensus.PollV3Height = std::numeric_limits<int>::max();
70-
consensus.ProjectV2Height = std::numeric_limits<int>::max();
68+
consensus.BlockV12Height = 2671700;
69+
consensus.PollV3Height = 2671700;
70+
consensus.ProjectV2Height = 2671700;
7171
// Immediately post zero payment interval fees 40% for mainnet
7272
consensus.InitialMRCFeeFractionPostZeroInterval = Fraction(2, 5);
7373
// Zero day interval is 14 days on mainnet
@@ -84,7 +84,6 @@ class CMainParams : public CChainParams {
8484
pchMessageStart[1] = 0x35;
8585
pchMessageStart[2] = 0x22;
8686
pchMessageStart[3] = 0x05;
87-
vAlertPubKey = ParseHex("049ac003b3318d9fe28b2830f6a95a2624ce2a69fb0c0c7ac0b513efcc1e93a6a6e8eba84481155dd82f2f1104e0ff62c69d662b0094639b7106abc5d84f948c0a");
8887
nDefaultPort = 32749;
8988
m_assumed_blockchain_size = 4;
9089

@@ -141,8 +140,16 @@ class CMainParams : public CChainParams {
141140
}
142141
};
143142

143+
// Master and alert keys other than the original are shorter because they are compressed.
144+
145+
// The original alert key was the same as the "master" (administrative contract) key For
146+
// before Kermit's Mom (< 5.3.3.12, < 5.4.0.0)
147+
// TestNet alerts public key for Kermit's Mom and beyond (>= 5.3.3.12, >= 5.4.0.0):
148+
vAlertPubKey = ParseHex("0352063cf6cf0317cc848ae24f3ed8b525334d2f059f242d27975f8c3a2e91b446");
149+
144150
masterkeys = {
145-
{0, ParseHex("049ac003b3318d9fe28b2830f6a95a2624ce2a69fb0c0c7ac0b513efcc1e93a6a6e8eba84481155dd82f2f1104e0ff62c69d662b0094639b7106abc5d84f948c0a")}
151+
{0, ParseHex("049ac003b3318d9fe28b2830f6a95a2624ce2a69fb0c0c7ac0b513efcc1e93a6a6e8eba84481155dd82f2f1104e0ff62c69d662b0094639b7106abc5d84f948c0a")},
152+
{2671700, ParseHex("0288b33697c4c752f922764bf1a5075fa96bad46aaf4f0579bf7d19ab048e200f0")}
146153
};
147154
}
148155
};
@@ -175,9 +182,6 @@ class CTestNetParams : public CChainParams {
175182
pchMessageStart[1] = 0xf2;
176183
pchMessageStart[2] = 0xc0;
177184
pchMessageStart[3] = 0xef;
178-
vAlertPubKey = ParseHex("0471dc165db490094d35cde15b1f5d755fa6ad6f2b5ed0f340e3f17f57389c3c2af113a8cbcc885bde73305a553b5640c83021128008ddf882e856336269080496");
179-
// TestNet alerts private key
180-
// "308201130201010420b665cff1884e53da26376fd1b433812c9a5a8a4d5221533b15b9629789bb7e42a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000471dc165db490094d35cde15b1f5d755fa6ad6f2b5ed0f340e3f17f57389c3c2af113a8cbcc885bde73305a553b5640c83021128008ddf882e856336269080496"
181185
nDefaultPort = 32748;
182186
m_assumed_blockchain_size = 2;
183187

@@ -198,8 +202,18 @@ class CTestNetParams : public CChainParams {
198202
}
199203
};
200204

205+
206+
// Master and keys other than the original are shorter because they are compressed.
207+
208+
// TestNet alerts private key for before Kermit's Mom (< 5.3.3.12, < 5.4.0.0):
209+
// "308201130201010420b665cff1884e53da26376fd1b433812c9a5a8a4d5221533b15b9629789bb7e42a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000471dc165db490094d35cde15b1f5d755fa6ad6f2b5ed0f340e3f17f57389c3c2af113a8cbcc885bde73305a553b5640c83021128008ddf882e856336269080496"
210+
// TestNet alerts private key for Kermit's Mom and beyond (>= 5.3.3.12, >= 5.4.0.0):
211+
// "925ekjvCRKuwEzu2WuqifVFE2T3r755rwBNN3ck7Fr8esTdQdrA"
212+
vAlertPubKey = ParseHex("02bf4aa6330f525ab91a25cd5c1362481d16d8c039b3d27cb48ac0870176202462");
213+
201214
masterkeys = {
202-
{0, ParseHex("049ac003b3318d9fe28b2830f6a95a2624ce2a69fb0c0c7ac0b513efcc1e93a6a6e8eba84481155dd82f2f1104e0ff62c69d662b0094639b7106abc5d84f948c0a")}
215+
{0, ParseHex("049ac003b3318d9fe28b2830f6a95a2624ce2a69fb0c0c7ac0b513efcc1e93a6a6e8eba84481155dd82f2f1104e0ff62c69d662b0094639b7106abc5d84f948c0a")},
216+
{1964600, ParseHex("031886a6776699cbd6362df7641c5d128146afabc769dfa36f1630889c706ce730")}
203217
};
204218
}
205219
};

src/chainparams.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class CChainParams
5252
}
5353

5454
assert(false && "No master key specified or height is negative.");
55-
};
55+
}
5656
int GetDefaultPort() const { return nDefaultPort; }
5757

5858
// const CBlock& GenesisBlock() const { return genesis; }
@@ -71,7 +71,6 @@ class CChainParams
7171

7272
Consensus::Params consensus;
7373
CMessageHeader::MessageStartChars pchMessageStart;
74-
std::vector<unsigned char> vAlertPubKey;
7574
int nDefaultPort;
7675
uint64_t m_assumed_blockchain_size;
7776
unsigned char base58Prefix[MAX_BASE58_TYPES];
@@ -80,6 +79,7 @@ class CChainParams
8079
bool m_is_test_chain;
8180
bool m_is_mockable_chain;
8281
CCheckpointData checkpointData;
82+
std::vector<unsigned char> vAlertPubKey;
8383
MapMasterKeys masterkeys;
8484
};
8585

src/rpc/client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
133133
{ "consolidatemsunspent" , 4 },
134134
{ "consolidateunspent" , 3 },
135135
{ "consolidateunspent" , 4 },
136+
{ "dumpprivkey" , 1 },
136137
{ "getbalance" , 1 },
137138
{ "getbalance" , 2 },
138139
{ "getbalancedetail" , 0 },

src/rpc/net.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
#include "wallet/walletdb.h"
1212
#include "net.h"
1313
#include "banman.h"
14+
#include "logging.h"
1415

1516
using namespace std;
1617

18+
extern std::map<uint256, CAlert> mapAlerts;
19+
extern CCriticalSection cs_mapAlerts;
20+
1721
UniValue getconnectioncount(const UniValue& params, bool fHelp)
1822
{
1923
if (fHelp || params.size() != 0)
@@ -384,6 +388,61 @@ UniValue getnettotals(const UniValue& params, bool fHelp)
384388
return obj;
385389
}
386390

391+
UniValue listalerts(const UniValue& params, bool fHelp)
392+
{
393+
if (fHelp || params.size() > 0)
394+
throw runtime_error(
395+
"listalerts\n"
396+
"\n"
397+
"Returns information about alerts.\n");
398+
399+
LOCK(cs_mapAlerts);
400+
401+
UniValue result(UniValue::VOBJ);
402+
UniValue alerts(UniValue::VARR);
403+
404+
405+
for (const auto& iter_alert : mapAlerts) {
406+
UniValue alert(UniValue::VOBJ);
407+
408+
alert.pushKV("version", iter_alert.second.nVersion);
409+
alert.pushKV("relay_until", DateTimeStrFormat(iter_alert.second.nRelayUntil));
410+
alert.pushKV("expiration", DateTimeStrFormat(iter_alert.second.nExpiration));
411+
alert.pushKV("id", iter_alert.second.nID);
412+
alert.pushKV("cancel_upto", iter_alert.second.nCancel);
413+
414+
UniValue set_cancel(UniValue::VARR);
415+
for (const auto& cancel : iter_alert.second.setCancel) {
416+
set_cancel.push_back(cancel);
417+
}
418+
alert.pushKV("cancels", set_cancel);
419+
420+
alert.pushKV("minimum_version", iter_alert.second.nMinVer);
421+
alert.pushKV("maximum_version", iter_alert.second.nMaxVer);
422+
423+
UniValue set_subver(UniValue::VARR);
424+
for (const auto& subver : iter_alert.second.setSubVer) {
425+
set_subver.push_back(subver);
426+
}
427+
alert.pushKV("subversions", set_subver);
428+
429+
alert.pushKV("priority", iter_alert.second.nPriority);
430+
431+
alert.pushKV("comment", iter_alert.second.strComment);
432+
alert.pushKV("status_bar", iter_alert.second.strStatusBar);
433+
alert.pushKV("reserved", iter_alert.second.strReserved);
434+
435+
alert.pushKV("hash", iter_alert.second.GetHash().GetHex());
436+
alert.pushKV("in_effect", iter_alert.second.IsInEffect());
437+
alert.pushKV("applies_to_me", iter_alert.second.AppliesToMe());
438+
439+
alerts.push_back(alert);
440+
}
441+
442+
result.pushKV("alerts", alerts);
443+
444+
return result;
445+
}
387446

388447

389448
// ppcoin: send alert.

src/rpc/server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ static const CRPCCommand vRPCCommands[] =
378378
{ "getlistof", &getlistof, cat_developer },
379379
{ "getrecentblocks", &rpc_getrecentblocks, cat_developer },
380380
{ "inspectaccrualsnapshot", &inspectaccrualsnapshot, cat_developer },
381+
{ "listalerts", &listalerts, cat_developer },
381382
{ "listdata", &listdata, cat_developer },
382383
{ "listprojects", &listprojects, cat_developer },
383384
{ "listresearcheraccounts", &listresearcheraccounts, cat_developer },

src/rpc/server.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ extern UniValue dumpcontracts(const UniValue& params, bool fHelp);
190190
extern UniValue rpc_getblockstats(const UniValue& params, bool fHelp);
191191
extern UniValue getlistof(const UniValue& params, bool fHelp);
192192
extern UniValue inspectaccrualsnapshot(const UniValue& params, bool fHelp);
193+
extern UniValue listalerts(const UniValue& params, bool fHelp);
193194
extern UniValue listdata(const UniValue& params, bool fHelp);
194195
extern UniValue listprojects(const UniValue& params, bool fHelp);
195196
extern UniValue listresearcheraccounts(const UniValue& params, bool fHelp);

src/wallet/rpcdump.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@ UniValue importwallet(const UniValue& params, bool fHelp)
274274

275275
UniValue dumpprivkey(const UniValue& params, bool fHelp)
276276
{
277-
if (fHelp || params.size() != 1)
277+
if (fHelp || params.size() < 1 || params.size() > 2)
278278
throw runtime_error(
279-
"dumpprivkey <gridcoinaddress>\n"
279+
"dumpprivkey <gridcoinaddress> [bool:dump hex]\n"
280280
"<gridcoinaddress> -> Address of requested key\n"
281+
"[bool:dump hex] -> Optional; default false boolean to dump private and public key\n"
282+
" as hex strings to JSON in addition to private key base58 encoded"
281283
"\n"
282284
"Reveals the private key corresponding to <gridcoinaddress>\n");
283285

@@ -299,6 +301,21 @@ UniValue dumpprivkey(const UniValue& params, bool fHelp)
299301
bool fCompressed;
300302
if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed))
301303
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
304+
305+
306+
if (params.size() == 2 && params[1].isBool() && params[1].get_bool()) {
307+
CKey key_out;
308+
pwalletMain->GetKey(keyID, key_out);
309+
310+
UniValue result(UniValue::VOBJ);
311+
312+
result.pushKV("private_key", CBitcoinSecret(vchSecret, fCompressed).ToString());
313+
result.pushKV("private_key_hex", HexStr(key_out.GetPrivKey()));
314+
result.pushKV("public_key_hex", HexStr(key_out.GetPubKey()));
315+
316+
return result;
317+
}
318+
302319
return CBitcoinSecret(vchSecret, fCompressed).ToString();
303320
}
304321

0 commit comments

Comments
 (0)