Browse Source

BlockChainTests mining

cl-refactor
Dimitry 10 years ago
parent
commit
291fbcbd3b
  1. 2
      libethereum/Block.cpp
  2. 5
      libethereum/Block.h
  3. 7
      test/libethereum/blockchain.cpp

2
libethereum/Block.cpp

@ -709,7 +709,7 @@ bool Block::sealBlock(bytesConstRef _header)
ret.appendRaw(m_currentTxs);
ret.appendRaw(m_currentUncles);
ret.swapOut(m_currentBytes);
m_currentBlock = BlockInfo(_header, CheckNothing, h256(), HeaderData);
m_currentBlock = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData);
cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash() << ")";
// TODO: move into Sealer
StructuredLogger::minedNewBlock(

5
libethereum/Block.h

@ -29,6 +29,7 @@
#include <libdevcrypto/OverlayDB.h>
#include <libethcore/Exceptions.h>
#include <libethcore/BlockInfo.h>
#include <libethcore/Ethash.h>
#include <libethcore/Miner.h>
#include <libevm/ExtVMFace.h>
#include "Account.h"
@ -252,7 +253,7 @@ public:
bytes const& blockData() const { return m_currentBytes; }
/// Get the header information on the present block.
BlockInfo const& info() const { return m_currentBlock; }
Ethash::BlockHeader const& info() const { return m_currentBlock; }
private:
@ -288,7 +289,7 @@ private:
State m_precommit; ///< State at the point immediately prior to rewards.
BlockInfo m_previousBlock; ///< The previous block's information.
BlockInfo m_currentBlock; ///< The current block's information.
Ethash::BlockHeader m_currentBlock; ///< The current block's information.
bytes m_currentBytes; ///< The current block.
bool m_committedToMine = false; ///< Have we committed to mine on the present m_currentBlock?

7
test/libethereum/blockchain.cpp

@ -143,7 +143,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
vBiBlocks.clear();
vBiBlocks.push_back(biGenesisBlock);
TransientDirectory td_stateDB, td_bc;
TransientDirectory td_bc;
TransientDirectory td_stateDB;
FullBlockChain<Ethash> bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill);
//OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill));
@ -206,7 +207,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
//block.commitToSeal(bc);
//Block block(State::openDB(bc.genesisHash()), BaseState::Empty, biGenesisBlock.beneficiary());
Block block = bc.genesisBlock(State::openDB(bc.genesisHash())); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK
//trueState TempDir default constructor for bc's state same as for trueState ?
Block block = bc.genesisBlock(trueState.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK
//Block block (State::openDB(biGenesisBlock.hash()));
//Block block(state.db(), BaseState::Empty);
//mine a new block on top of previously imported

Loading…
Cancel
Save