mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Merge ElementsProject/elements#1518: Avoid Simplicity header dependency propogation
6c7788adf3Avoid Simplicity header dependency propogation (Russell O'Connor) Pull request description: The problem with including <simplicity/elements/env.h> in interpreter.h is that now everyone who needs to include interpreter.h also needs access to Simplicity's header files too. This commit breaks that dependency chain by using forward declarations. It will pay signifigant dividends when elements switches to CMake. ACKs for top commit: delta1: ACK6c7788a; built and tested locally apoelstra: ACK6c7788adf3; successfully ran local tests Tree-SHA512: 78d043a094f0a2bb51e0f103313ae568b42ec2852d8fe9a3fbbcad9c0fbf6829ef1347f83bfd361547ec165c01965e7342188a38d8faacfcf90ef70c5b7001f6
This commit is contained in:
commit
e360a967b6
2 changed files with 10 additions and 7 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <script/script.h>
|
||||
#include <uint256.h>
|
||||
extern "C" {
|
||||
#include <simplicity/elements/env.h>
|
||||
#include <simplicity/elements/exec.h>
|
||||
#include <simplicity/errorCodes.h>
|
||||
}
|
||||
|
|
@ -2675,6 +2676,10 @@ void PrecomputedTransactionData::Init(const T& txTo, std::vector<CTxOut>&& spent
|
|||
}
|
||||
}
|
||||
|
||||
void SimplicityTransactionDeleter::operator()(elementsTransaction* ptr) const {
|
||||
simplicity_elements_freeTransaction(ptr);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
PrecomputedTransactionData::PrecomputedTransactionData(const T& txTo)
|
||||
: PrecomputedTransactionData(uint256{})
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@
|
|||
#include <script/script_error.h>
|
||||
#include <span.h>
|
||||
#include <primitives/transaction.h>
|
||||
extern "C" {
|
||||
#include <simplicity/elements/env.h>
|
||||
}
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
|
@ -169,12 +166,13 @@ enum : uint32_t {
|
|||
|
||||
bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror);
|
||||
|
||||
// Forward declarations of Simplicity structures.
|
||||
struct elementsTransaction;
|
||||
struct rawElementsTapEnv;
|
||||
|
||||
struct SimplicityTransactionDeleter
|
||||
{
|
||||
void operator()(elementsTransaction* ptr)
|
||||
{
|
||||
simplicity_elements_freeTransaction(ptr);
|
||||
}
|
||||
void operator()(elementsTransaction* ptr) const;
|
||||
};
|
||||
using SimplicityTransactionUniquePtr = std::unique_ptr<elementsTransaction, SimplicityTransactionDeleter>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue