Deserialize merkle proofs without witness, which matters for dynafed

This commit is contained in:
Gregory Sanders 2019-05-31 11:31:02 -04:00
parent 830f917235
commit 8d3091bbcb
2 changed files with 7 additions and 1 deletions

View file

@ -188,7 +188,7 @@ static bool GetBlockAndTxFromMerkleBlock(uint256& block_hash, uint256& tx_hash,
try {
std::vector<uint256> tx_hashes;
std::vector<unsigned int> tx_indices;
CDataStream merkle_block_stream(merkle_block_raw, SER_NETWORK, PROTOCOL_VERSION);
CDataStream merkle_block_stream(merkle_block_raw, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
merkle_block_stream >> merkle_block;
block_hash = merkle_block.header.GetHash();

View file

@ -10,6 +10,7 @@
#include <primitives/bitcoin/transaction.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <chain.h>
/** Calculates script necessary for p2ch peg-in transactions */
CScript calculate_contract(const CScript& federationRedeemScript, const CScript& witnessProgram);
@ -31,4 +32,9 @@ CTxOut GetPeginOutputFromWitness(const CScriptWitness& pegin_witness);
*/
bool MatchLiquidWatchman(const CScript& script);
/** Get full fedpegscripts from two previous epoch starts based on given index
* nextblock_validation is false when doing block validation, true for mempool
* or "lookahead" purposes. Newest epochs first. */
std::vector<CScript> GetValidFedpegScripts(const CBlockIndex* pblockindex, const Consensus::Params& params, bool nextblock_validation);
#endif // BITCOIN_PEGINS_H