Skip to content

Commit 8d3091b

Browse files
committed
Deserialize merkle proofs without witness, which matters for dynafed
1 parent 830f917 commit 8d3091b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/pegins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static bool GetBlockAndTxFromMerkleBlock(uint256& block_hash, uint256& tx_hash,
188188
try {
189189
std::vector<uint256> tx_hashes;
190190
std::vector<unsigned int> tx_indices;
191-
CDataStream merkle_block_stream(merkle_block_raw, SER_NETWORK, PROTOCOL_VERSION);
191+
CDataStream merkle_block_stream(merkle_block_raw, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
192192
merkle_block_stream >> merkle_block;
193193
block_hash = merkle_block.header.GetHash();
194194

src/pegins.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <primitives/bitcoin/transaction.h>
1111
#include <primitives/transaction.h>
1212
#include <script/script.h>
13+
#include <chain.h>
1314

1415
/** Calculates script necessary for p2ch peg-in transactions */
1516
CScript calculate_contract(const CScript& federationRedeemScript, const CScript& witnessProgram);
@@ -31,4 +32,9 @@ CTxOut GetPeginOutputFromWitness(const CScriptWitness& pegin_witness);
3132
*/
3233
bool MatchLiquidWatchman(const CScript& script);
3334

35+
/** Get full fedpegscripts from two previous epoch starts based on given index
36+
* nextblock_validation is false when doing block validation, true for mempool
37+
* or "lookahead" purposes. Newest epochs first. */
38+
std::vector<CScript> GetValidFedpegScripts(const CBlockIndex* pblockindex, const Consensus::Params& params, bool nextblock_validation);
39+
3440
#endif // BITCOIN_PEGINS_H

0 commit comments

Comments
 (0)