Skip to content

Commit

Permalink
Merge #20048: chainparams: do not log signet startup messages for oth…
Browse files Browse the repository at this point in the history
…er chains

6fccad7 signet: do not log signet startup messages for other chains (Jon Atack)

Pull request description:

  The following signet startup messages are printed to the debug log immediately on node startup for all chains. This behavior occurs on master as a side effect after the merge of #20014. This PR removes the first message and moves the signet derived magic logging to `init.cpp`.
  ```
  $ ./src/bitcoind
  2020-09-30T14:25:15Z Using default signet network
  2020-09-30T14:25:15Z Signet derived magic (message start): 0a03cf40
  2020-09-30T14:25:15Z Bitcoin Core version v0.20.99.0 ...
  ```

ACKs for top commit:
  MarcoFalke:
    ACK 6fccad7
  kallewoof:
    utACK 6fccad7
  hebasto:
    ACK 6fccad7

Tree-SHA512: 33821dce89b24caf7b7c1ecb41e572ecfb26e6958a1316d359ff240e6ef97c4a1f2cf1b4b974596b252815f9df23960ce385c132ebdbc855bbe6123c3b0b003a
  • Loading branch information
MarcoFalke committed Oct 1, 2020
2 parents 40aab35 + 6fccad7 commit 9fc2f01
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ class SigNetParams : public CChainParams {
vSeeds.clear();

if (!args.IsArgSet("-signetchallenge")) {
LogPrintf("Using default signet network\n");
bin = ParseHex("512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae");
vSeeds.emplace_back("178.128.221.177");
vSeeds.emplace_back("2a01:7c8:d005:390::5");
Expand Down Expand Up @@ -327,7 +326,6 @@ class SigNetParams : public CChainParams {
h << consensus.signet_challenge;
uint256 hash = h.GetHash();
memcpy(pchMessageStart, hash.begin(), 4);
LogPrintf("Signet derived magic (message start): %s\n", HexStr({pchMessageStart, pchMessageStart + 4}));

nDefaultPort = 38333;
nPruneAfterHeight = 1000;
Expand Down
4 changes: 4 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/settings.h>
#include <protocol.h>
#include <rpc/blockchain.h>
#include <rpc/register.h>
#include <rpc/server.h>
Expand Down Expand Up @@ -966,6 +967,9 @@ bool AppInitParameterInteraction(const ArgsManager& args)
// specified in default section of config file, but not overridden
// on the command line or in this network's section of the config file.
std::string network = args.GetChainName();
if (network == CBaseChainParams::SIGNET) {
LogPrintf("Signet derived magic (message start): %s\n", HexStr(chainparams.MessageStart()));
}
bilingual_str errors;
for (const auto& arg : args.GetUnsuitableSectionOnlyArgs()) {
errors += strprintf(_("Config setting for %s only applied on %s network when in [%s] section.") + Untranslated("\n"), arg, network, network);
Expand Down
4 changes: 4 additions & 0 deletions test/functional/feature_signet.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def run_test(self):

assert_equal(self.nodes[4].submitblock(signet_blocks[0]), 'bad-signet-blksig')

self.log.info("test that signet logs the network magic on node start")
with self.nodes[0].assert_debug_log(["Signet derived magic (message start)"]):
self.restart_node(0)


if __name__ == '__main__':
SignetBasicTest().main()

0 comments on commit 9fc2f01

Please sign in to comment.