Line data Source code
1 : // Copyright (c) 2019-2021 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #ifndef BITCOIN_SIGNET_H 6 : #define BITCOIN_SIGNET_H 7 : 8 : #include <consensus/params.h> 9 : #include <primitives/block.h> 10 : #include <primitives/transaction.h> 11 : 12 : #include <optional> 13 : 14 : /** 15 : * Extract signature and check whether a block has a valid solution 16 : */ 17 : bool CheckSignetBlockSolution(const CBlock& block, const Consensus::Params& consensusParams); 18 : 19 : /** 20 : * Generate the signet tx corresponding to the given block 21 : * 22 : * The signet tx commits to everything in the block except: 23 : * 1. It hashes a modified merkle root with the signet signature removed. 24 : * 2. It skips the nonce. 25 : */ 26 0 : class SignetTxs { 27 : template<class T1, class T2> 28 0 : SignetTxs(const T1& to_spend, const T2& to_sign) : m_to_spend{to_spend}, m_to_sign{to_sign} { } 29 : 30 : public: 31 : static std::optional<SignetTxs> Create(const CBlock& block, const CScript& challenge); 32 : 33 : const CTransaction m_to_spend; 34 : const CTransaction m_to_sign; 35 : }; 36 : 37 : #endif // BITCOIN_SIGNET_H