Exemplo n.º 1
0
validate_transaction::validate_transaction(block_chain& chain,
    const chain::transaction& tx, const transaction_pool& pool,
    dispatcher& dispatch)
  : blockchain_(chain),
    tx_(tx),
    pool_(pool),
    dispatch_(dispatch),
    tx_hash_(tx.hash())
{
}
Exemplo n.º 2
0
void transaction_database::store(size_t height, size_t index,
    const chain::transaction& tx)
{
    // Write block data.
    const hash_digest key = tx.hash();
    const size_t value_size = 4 + 4 + tx.serialized_size();
    auto write = [&height, &index, &tx](uint8_t* data)
    {
        auto serial = make_serializer(data);
        serial.write_4_bytes_little_endian(height);
        serial.write_4_bytes_little_endian(index);
        data_chunk tx_data = tx.to_data();
        serial.write_data(tx_data);
    };
    map_.store(key, write, value_size);
}