Browse Source

Allow pre-mining if it's us.

cl-refactor
Gav Wood 10 years ago
parent
commit
369d45634a
  1. 4
      libethereum/BlockQueue.cpp
  2. 2
      libethereum/BlockQueue.h
  3. 2
      libethereum/Client.cpp

4
libethereum/BlockQueue.cpp

@ -29,7 +29,7 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc)
ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, bool _isOurs)
{
// Check if we already know this block.
h256 h = BlockInfo::headerHash(_block);
@ -70,7 +70,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc)
UpgradeGuard ul(l);
// Check it's not in the future
if (bi.timestamp > (u256)time(0))
if (bi.timestamp > (u256)time(0) && !_isOurs)
{
m_future.insert(make_pair((unsigned)bi.timestamp, _block.toBytes()));
cblockq << "OK - queued for future.";

2
libethereum/BlockQueue.h

@ -55,7 +55,7 @@ class BlockQueue
{
public:
/// Import a block into the queue.
ImportResult import(bytesConstRef _tx, BlockChain const& _bc);
ImportResult import(bytesConstRef _tx, BlockChain const& _bc, bool _isOurs = false);
/// Notes that time has moved on and some blocks that used to be "in the future" may no be valid.
void tick(BlockChain const& _bc);

2
libethereum/Client.cpp

@ -425,7 +425,7 @@ bool Client::submitWork(ProofOfWork::Solution const& _solution)
return false;
newBlock = m_postMine.blockData();
}
m_bq.import(&newBlock, m_bc);
m_bq.import(&newBlock, m_bc, true);
/*
ImportRoute ir = m_bc.attemptImport(newBlock, m_stateDB);
if (!ir.first.empty())

Loading…
Cancel
Save