From 404682b7cdb54494e7c98f0ba0cac8b51f379750 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Wed, 17 Jul 2019 17:41:32 +0900 Subject: [PATCH] add signet basic support (signet.cpp) Co-authored-by: Anthony Towns --- src/Makefile.am | 2 + src/consensus/params.h | 7 ++ src/signet.cpp | 149 +++++++++++++++++++++++++++++++++++++++++ src/signet.h | 42 ++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 src/signet.cpp create mode 100644 src/signet.h diff --git a/src/Makefile.am b/src/Makefile.am index 175501d4a69..53ad03d41f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -201,6 +201,7 @@ BITCOIN_CORE_H = \ script/signingprovider.h \ script/standard.h \ shutdown.h \ + signet.h \ streams.h \ support/allocators/secure.h \ support/allocators/zeroafterfree.h \ @@ -321,6 +322,7 @@ libbitcoin_server_a_SOURCES = \ rpc/server.cpp \ script/sigcache.cpp \ shutdown.cpp \ + signet.cpp \ timedata.cpp \ torcontrol.cpp \ txdb.cpp \ diff --git a/src/consensus/params.h b/src/consensus/params.h index 61b1fbc2e5a..85ab3f61ef5 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -80,6 +80,13 @@ struct Params { int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; } uint256 nMinimumChainWork; uint256 defaultAssumeValid; + + /** + * If true, witness commitments contain a payload equal to a Bitcoin Script solution + * to the signet challenge. See BIP325. + */ + bool signet_blocks{false}; + std::vector signet_challenge; }; } // namespace Consensus diff --git a/src/signet.cpp b/src/signet.cpp new file mode 100644 index 00000000000..a29f89b58e7 --- /dev/null +++ b/src/signet.cpp @@ -0,0 +1,149 @@ +// Copyright (c) 2019-2020 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include