mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-19 11:18:09 +02:00
multiprocess: Add serialization code for CTransaction
Add support for passing CTransaction and CTransactionRef types to IPC functions. These types can't be passed currently because IPC serialization code currently only supports deserializing types that have an Unserialize() method, which CTransaction does not, because it is supposed to represent immutable transactions. Work around this by adding a CustomReadField overload that will call CTransaction's deserialize_type constructor. These types also can't be passed currently because serializing transactions requires TransactionSerParams to be set. Fix this by setting TX_WITH_WITNESS as default serialization parameters for IPC code.
This commit is contained in:
@@ -88,6 +88,15 @@ void IpcPipeTest()
|
||||
UniValue uni2{foo->passUniValue(uni1)};
|
||||
BOOST_CHECK_EQUAL(uni1.write(), uni2.write());
|
||||
|
||||
CMutableTransaction mtx;
|
||||
mtx.version = 2;
|
||||
mtx.nLockTime = 3;
|
||||
mtx.vin.emplace_back(txout1);
|
||||
mtx.vout.emplace_back(COIN, CScript());
|
||||
CTransactionRef tx1{MakeTransactionRef(mtx)};
|
||||
CTransactionRef tx2{foo->passTransaction(tx1)};
|
||||
BOOST_CHECK(*Assert(tx1) == *Assert(tx2));
|
||||
|
||||
// Test cleanup: disconnect pipe and join thread
|
||||
disconnect_client();
|
||||
thread.join();
|
||||
|
||||
Reference in New Issue
Block a user