Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
scriptpubkeyman_tests.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-present 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#include <key.h>
6#include <key_io.h>
8#include <script/solver.h>
10#include <wallet/wallet.h>
11#include <wallet/test/util.h>
12
13#include <boost/test/unit_test.hpp>
14
15namespace wallet {
17
19{
20 std::unique_ptr<interfaces::Chain>& chain = m_node.chain;
21
22 CWallet keystore(chain.get(), "", CreateMockableWalletDatabase());
24
25 // Verify that a SigningProvider for a pubkey is only returned if its corresponding private key is available
27 std::string desc_str = "tr(" + EncodeSecret(key_internal) + ",pk(" + HexStr(key_scriptpath.GetPubKey()) + "))";
29 BOOST_CHECK(spk_man1 != nullptr);
30 auto signprov_keypath_spendable = spk_man1->GetSigningProvider(key_internal.GetPubKey());
32
33 desc_str = "tr(" + HexStr(XOnlyPubKey::NUMS_H) + ",pk(" + HexStr(key_scriptpath.GetPubKey()) + "))";
35 BOOST_CHECK(spk_man2 != nullptr);
36 auto signprov_keypath_nums_h = spk_man2->GetSigningProvider(XOnlyPubKey::NUMS_H.GetEvenCorrespondingCPubKey());
38}
39
41} // namespace wallet
node::NodeContext m_node
static const XOnlyPubKey NUMS_H
Nothing Up My Sleeve point H Used as an internal key for provably disabling the key path spend see BI...
Definition pubkey.h:195
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition wallet.h:310
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Definition hex_base.cpp:30
CKey GenerateRandomKey(bool compressed) noexcept
Definition key.cpp:475
std::string EncodeSecret(const CKey &key)
Definition key_io.cpp:231
wallet::DescriptorScriptPubKeyMan * CreateDescriptor(CWallet &keystore, const std::string &desc_str, const bool success)
Definition util.cpp:221
BOOST_AUTO_TEST_CASE(bnb_test)
#define BOOST_CHECK(expr)
Definition object.cpp:16
Basic testing setup.
std::unique_ptr< interfaces::Chain > chain
Definition context.h:76
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:73