Exemplo n.º 1
0
std::vector<uint256> ThinBlockBuilder::getHashes(const CMerkleBlock& m) const {

    std::vector<uint256> txHashes;
    // FIXME: Calculate a sane number of max
    // transactions here, or skip the check.
    uint256 merkleRoot = CMerkleBlock(m).txn.ExtractMatches(txHashes);
    if (m.header.hashMerkleRoot != merkleRoot)
        throw thinblock_error("Failed to match Merkle root or bad tree in thin block");

    return txHashes;
}
Exemplo n.º 2
0
std::vector<ThinTx> ThinBloomStub::allTransactions() const {
    std::vector<uint256> txHashes;

    // Has a side effect of validating the MerkeleBlock hash
    // and can throw a thinblock_error
    uint256 merkleRoot = CMerkleBlock(merkleblock).txn.ExtractMatches(txHashes);
    if (merkleblock.header.hashMerkleRoot != merkleRoot)
        throw thinblock_error("Failed to match Merkle root or bad tree in thin block");

    return std::vector<ThinTx>(txHashes.begin(), txHashes.end());
}
Exemplo n.º 3
0
    MerkleblockSetup() :
        mstream(SER_NETWORK, PROTOCOL_VERSION),
        tmgr(std::unique_ptr<ThinBlockFinishedCallb>(new DummyFinishedCallb),
             std::unique_ptr<InFlightEraser>(new DummyInFlightEraser))
    {
        CBloomFilter emptyFilter;
        mblock = CMerkleBlock(TestBlock2(), emptyFilter);
        mstream << mblock;

        // test assert when pushing ping to pfrom if consensus params
        // are not set.
        SelectParams(CBaseChainParams::MAIN);

        // asserts if fPrintToDebugLog is true
        fPrintToDebugLog = false;
    }