You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

/*
This file is part of cpp-ethereum.
cpp-ethereum 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.
Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file BlockInfo.h
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
11 years ago
#pragma once
#include "Common.h"
namespace eth
{
struct BlockInfo
{
public:
u256 hash;
u256 parentHash;
u256 sha256Uncles;
u256 coinbaseAddress;
u256 sha256Transactions;
u256 difficulty;
u256 timestamp;
u256 nonce;
u256 number;
BlockInfo();
explicit operator bool() { return number != Invalid256; }
bool operator==(BlockInfo const& _cmp) const { return hash == _cmp.hash && parentHash == _cmp.parentHash && nonce == _cmp.nonce && number == _cmp.number; }
static BlockInfo const& genesis() { if (!s_genesis) (s_genesis = new BlockInfo)->populateGenesis(); return *s_genesis; }
void populate(bytesConstRef _block, u256 _number = 0);
void verifyInternals(bytesConstRef _block);
static bytes createGenesisBlock();
private:
void populateGenesis();
static BlockInfo* s_genesis;
11 years ago
};
}