Skip to content

Commit 0d44c44

Browse files
committed
util: move error.h TransactionError enum to node/types.h
New node/types.h file is analagous to existing wallet/types.h and is a better place to define simple node types that are shared externally with wallet and gui code than the util library. Motivation for this change is to completely remove util/error.h file currently holding TransactionError in a followup commit.
1 parent 9bcce26 commit 0d44c44

File tree

4 files changed

+41
-22
lines changed

4 files changed

+41
-22
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ BITCOIN_CORE_H = \
234234
node/timeoffsets.h \
235235
node/transaction.h \
236236
node/txreconciliation.h \
237+
node/types.h \
237238
node/utxo_snapshot.h \
238239
node/validation_cache_args.h \
239240
noui.h \

src/node/types.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2010-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+
//! @file node/types.h is a home for public enum and struct type definitions
6+
//! that are used by internally by node code, but also used externally by wallet
7+
//! or GUI code.
8+
//!
9+
//! This file is intended to define only simple types that do not have external
10+
//! dependencies. More complicated types should be defined in dedicated header
11+
//! files.
12+
13+
#ifndef BITCOIN_NODE_TYPES_H
14+
#define BITCOIN_NODE_TYPES_H
15+
16+
enum class TransactionError {
17+
OK, //!< No error
18+
MISSING_INPUTS,
19+
ALREADY_IN_CHAIN,
20+
P2P_DISABLED,
21+
MEMPOOL_REJECTED,
22+
MEMPOOL_ERROR,
23+
INVALID_PSBT,
24+
PSBT_MISMATCH,
25+
SIGHASH_MISMATCH,
26+
MAX_FEE_EXCEEDED,
27+
MAX_BURN_EXCEEDED,
28+
EXTERNAL_SIGNER_NOT_FOUND,
29+
EXTERNAL_SIGNER_FAILED,
30+
INVALID_PACKAGE,
31+
};
32+
33+
#endif // BITCOIN_NODE_TYPES_H

src/util/error.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,11 @@
1515
* translating errors passed across wallet/node/rpc/gui code boundaries.
1616
*/
1717

18+
#include <node/types.h>
1819
#include <string>
1920

2021
struct bilingual_str;
2122

22-
enum class TransactionError {
23-
OK, //!< No error
24-
MISSING_INPUTS,
25-
ALREADY_IN_CHAIN,
26-
P2P_DISABLED,
27-
MEMPOOL_REJECTED,
28-
MEMPOOL_ERROR,
29-
INVALID_PSBT,
30-
PSBT_MISMATCH,
31-
SIGHASH_MISMATCH,
32-
MAX_FEE_EXCEEDED,
33-
MAX_BURN_EXCEEDED,
34-
EXTERNAL_SIGNER_NOT_FOUND,
35-
EXTERNAL_SIGNER_FAILED,
36-
INVALID_PACKAGE,
37-
};
38-
3923
bilingual_str TransactionErrorString(const TransactionError error);
4024

4125
bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind);

src/wallet/types.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
//! @file Public type definitions that are used inside and outside of the wallet
7-
//! (e.g. by src/wallet and src/interfaces and src/qt code).
6+
//! @file wallet/types.h is a home for public enum and struct type definitions
7+
//! that are used by internally by wallet code, but also used externally by node
8+
//! or GUI code.
89
//!
9-
//! File is home for simple enum and struct definitions that don't deserve
10-
//! separate header files. More complicated wallet public types like
11-
//! CCoinControl that are used externally can have separate headers.
10+
//! This file is intended to define only simple types that do not have external
11+
//! dependencies. More complicated public wallet types like CCoinControl should
12+
//! be defined in dedicated header files.
1213

1314
#ifndef BITCOIN_WALLET_TYPES_H
1415
#define BITCOIN_WALLET_TYPES_H

0 commit comments

Comments
 (0)