1818#include < script/sign.h>
1919#include < script/signingprovider.h>
2020
21- #include < boost/ variant.hpp >
21+ #include < variant>
2222
2323// Magic bytes
2424static constexpr uint8_t PSBT_MAGIC_BYTES[5 ] = {' p' , ' s' , ' b' , ' t' , 0xff };
@@ -95,8 +95,8 @@ struct PSBTInput
9595 CAsset asset;
9696 uint256 asset_blinding_factor;
9797
98- boost ::variant<boost::blank , CTransactionRef, Sidechain::Bitcoin::CTransactionRef> peg_in_tx;
99- boost ::variant<boost::blank , CMerkleBlock, Sidechain::Bitcoin::CMerkleBlock> txout_proof;
98+ std ::variant<std::monostate , CTransactionRef, Sidechain::Bitcoin::CTransactionRef> peg_in_tx;
99+ std ::variant<std::monostate , CMerkleBlock, Sidechain::Bitcoin::CMerkleBlock> txout_proof;
100100 CScript claim_script;
101101 uint256 genesis_hash;
102102
@@ -182,35 +182,35 @@ struct PSBTInput
182182
183183 // Write peg-in data
184184 if (Params ().GetConsensus ().ParentChainHasPow ()) {
185- if (peg_in_tx.which () > 0 ) {
186- const Sidechain::Bitcoin::CTransactionRef& btc_peg_in_tx = boost::get <Sidechain::Bitcoin::CTransactionRef>(peg_in_tx);
185+ if (peg_in_tx.index () > 0 ) {
186+ const auto btc_peg_in_tx = std::get_if <Sidechain::Bitcoin::CTransactionRef>(& peg_in_tx);
187187 if (btc_peg_in_tx) {
188188 SerializeToVector (s, PSBT_IN_PROPRIETARY, PSBT_ELEMENTS_ID, PSBT_IN_PEG_IN_TX);
189189 OverrideStream<Stream> os (&s, s.GetType (), s.GetVersion () | SERIALIZE_TRANSACTION_NO_WITNESS);
190- SerializeToVector (os, btc_peg_in_tx);
190+ SerializeToVector (os, * btc_peg_in_tx);
191191 }
192192 }
193- if (txout_proof.which () > 0 ) {
194- const Sidechain::Bitcoin::CMerkleBlock& btc_txout_proof = boost::get <Sidechain::Bitcoin::CMerkleBlock>(txout_proof);
195- if (! btc_txout_proof. header . IsNull () ) {
193+ if (txout_proof.index () > 0 ) {
194+ const auto btc_txout_proof = std::get_if <Sidechain::Bitcoin::CMerkleBlock>(& txout_proof);
195+ if (btc_txout_proof) {
196196 SerializeToVector (s, PSBT_IN_PROPRIETARY, PSBT_ELEMENTS_ID, PSBT_IN_TXOUT_PROOF);
197- SerializeToVector (s, btc_txout_proof);
197+ SerializeToVector (s, * btc_txout_proof);
198198 }
199199 }
200200 } else {
201- if (peg_in_tx.which () > 0 ) {
202- const CTransactionRef& elem_peg_in_tx = boost::get <CTransactionRef>(peg_in_tx);
201+ if (peg_in_tx.index () > 0 ) {
202+ const auto elem_peg_in_tx = std::get_if <CTransactionRef>(& peg_in_tx);
203203 if (elem_peg_in_tx) {
204204 SerializeToVector (s, PSBT_IN_PROPRIETARY, PSBT_ELEMENTS_ID, PSBT_IN_PEG_IN_TX);
205205 OverrideStream<Stream> os (&s, s.GetType (), s.GetVersion () | SERIALIZE_TRANSACTION_NO_WITNESS);
206- SerializeToVector (os, elem_peg_in_tx);
206+ SerializeToVector (os, * elem_peg_in_tx);
207207 }
208208 }
209- if (txout_proof.which () > 0 ) {
210- const CMerkleBlock& elem_txout_proof = boost::get <CMerkleBlock>(txout_proof);
211- if (! elem_txout_proof. header . IsNull () ) {
209+ if (txout_proof.index () > 0 ) {
210+ const auto elem_txout_proof = std::get_if <CMerkleBlock>(& txout_proof);
211+ if (elem_txout_proof) {
212212 SerializeToVector (s, PSBT_IN_PROPRIETARY, PSBT_ELEMENTS_ID, PSBT_IN_TXOUT_PROOF);
213- SerializeToVector (s, elem_txout_proof);
213+ SerializeToVector (s, * elem_txout_proof);
214214 }
215215 }
216216 }
@@ -412,7 +412,7 @@ struct PSBTInput
412412 }
413413 case PSBT_IN_PEG_IN_TX:
414414 {
415- if (peg_in_tx.which () != 0 ) {
415+ if (peg_in_tx.index () != 0 ) {
416416 throw std::ios_base::failure (" Duplicate Key, peg-in tx already provided" );
417417 } else if (subkey_len != 1 ) {
418418 throw std::ios_base::failure (" Peg-in tx key is more than one byte type" );
@@ -432,7 +432,7 @@ struct PSBTInput
432432 }
433433 case PSBT_IN_TXOUT_PROOF:
434434 {
435- if (txout_proof.which () != 0 ) {
435+ if (txout_proof.index () != 0 ) {
436436 throw std::ios_base::failure (" Duplicate Key, peg-in txout proof already provided" );
437437 } else if (subkey_len != 1 ) {
438438 throw std::ios_base::failure (" Peg-in txout proof key is more than one byte type" );
0 commit comments