Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
wallet
test
wallet_transaction_tests.cpp
Go to the documentation of this file.
1
// Copyright (c) 2021-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 <
wallet/transaction.h
>
6
7
#include <
test/util/common.h
>
8
#include <
wallet/test/wallet_test_fixture.h
>
9
10
#include <boost/test/unit_test.hpp>
11
12
namespace
wallet
{
13
BOOST_FIXTURE_TEST_SUITE
(wallet_transaction_tests,
WalletTestingSetup
)
14
15
BOOST_AUTO_TEST_CASE
(roundtrip)
16
{
17
for
(uint8_t hash = 0; hash < 5; ++hash) {
18
for
(
int
index = -2; index < 3; ++index) {
19
TxState
state =
TxStateInterpretSerialized
(
TxStateUnrecognized
{
uint256
{hash}, index});
20
BOOST_CHECK_EQUAL
(
TxStateSerializedBlockHash
(state),
uint256
{hash});
21
BOOST_CHECK_EQUAL
(
TxStateSerializedIndex
(state), index);
22
}
23
}
24
}
25
26
BOOST_AUTO_TEST_SUITE_END
()
27
}
// namespace wallet
uint256
256-bit opaque blob.
Definition
uint256.h:195
BOOST_FIXTURE_TEST_SUITE
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
wallet
Definition
wallet_balance.cpp:26
wallet::TxStateSerializedIndex
static int TxStateSerializedIndex(const TxState &state)
Get TxState serialized block index. Inverse of TxStateInterpretSerialized.
Definition
transaction.h:112
wallet::TxStateInterpretSerialized
static TxState TxStateInterpretSerialized(TxStateUnrecognized data)
Try to interpret deserialized TxStateUnrecognized data as a recognized state.
Definition
transaction.h:85
wallet::BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(bnb_test)
Definition
coinselection_tests.cpp:123
wallet::TxStateSerializedBlockHash
static uint256 TxStateSerializedBlockHash(const TxState &state)
Get TxState serialized block hash. Inverse of TxStateInterpretSerialized.
Definition
transaction.h:100
wallet::TxState
std::variant< TxStateConfirmed, TxStateInMempool, TxStateBlockConflicted, TxStateInactive, TxStateUnrecognized > TxState
All possible CWalletTx states.
Definition
transaction.h:79
BOOST_CHECK_EQUAL
#define BOOST_CHECK_EQUAL(v1, v2)
Definition
object.cpp:17
wallet::TxStateUnrecognized
Definition
transaction.h:70
wallet::WalletTestingSetup
Testing setup and teardown for wallet.
Definition
wallet_test_fixture.h:22
common.h
transaction.h
wallet_test_fixture.h
Generated on
for Bitcoin Core by
1.17.0