639a57d957
This avoids a naming conflict with a p2p class BlockHeader. Notice that the block data structures are mostly still private API, they are in the utils dir but headers are not installed, nobody has needed them so far.
64 lines
2.0 KiB
C++
64 lines
2.0 KiB
C++
/*
|
|
* This file is part of the Flowee project
|
|
* Copyright (C) 2009-2010 Satoshi Nakamoto
|
|
* Copyright (C) 2009-2015 The Bitcoin Core developers
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef FLOWEE_MERKLEBLOCK_H
|
|
#define FLOWEE_MERKLEBLOCK_H
|
|
|
|
#include <utils/PartialMerkleTree.h>
|
|
#include "primitives/MutableBlock.h"
|
|
#include "bloom.h"
|
|
|
|
/**
|
|
* Used to relay blocks as header + vector<merkle branch>
|
|
* to filtered nodes.
|
|
*/
|
|
class CMerkleBlock
|
|
{
|
|
public:
|
|
/** Public only for unit testing */
|
|
BlockHeaderFields header;
|
|
CPartialMerkleTree txn;
|
|
|
|
public:
|
|
/** Public only for unit testing and relay testing (not relayed) */
|
|
std::vector<std::pair<unsigned int, uint256> > vMatchedTxn;
|
|
|
|
/**
|
|
* Create from a CBlock, filtering transactions according to filter
|
|
* Note that this will call IsRelevantAndUpdate on the filter for each transaction,
|
|
* thus the filter will likely be modified.
|
|
*/
|
|
CMerkleBlock(const MutableBlock& block, CBloomFilter& filter);
|
|
|
|
// Create from a CBlock, matching the txids in the set
|
|
CMerkleBlock(const MutableBlock& block, const std::set<uint256>& txids);
|
|
|
|
CMerkleBlock() {}
|
|
|
|
ADD_SERIALIZE_METHODS
|
|
|
|
template <typename Stream, typename Operation>
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
|
READWRITE(header);
|
|
READWRITE(txn);
|
|
}
|
|
};
|
|
|
|
#endif
|