Browse Source

Extra data.

cl-refactor
Gav Wood 10 years ago
parent
commit
56ed8a9207
  1. 2
      libethereum/Client.cpp
  2. 3
      libethereum/Client.h
  3. 3
      libethereum/State.cpp
  4. 2
      libethereum/State.h
  5. 3
      libwebthree/WebThree.cpp

2
libethereum/Client.cpp

@ -803,7 +803,7 @@ void Client::rejigMining()
{
clog(ClientTrace) << "Rejigging mining...";
DEV_WRITE_GUARDED(x_working)
m_working.commitToMine(m_bc);
m_working.commitToMine(m_bc, m_extraData);
DEV_READ_GUARDED(x_working)
{
DEV_WRITE_GUARDED(x_postMine)

3
libethereum/Client.h

@ -242,6 +242,8 @@ public:
void setSentinel(std::string const& _server) { m_sentinel = _server; }
/// Get the JSONRPC server to which we report bad blocks.
std::string const& sentinel() const { return m_sentinel; }
/// Set the extra data that goes into mined blocks.
void setExtraData(bytes const& _extraData) { m_extraData = _extraData; }
protected:
/// InterfaceStub methods
@ -359,6 +361,7 @@ private:
std::atomic<bool> m_syncBlockQueue = {false};
std::string m_sentinel;
bytes m_extraData;
};
}

3
libethereum/State.cpp

@ -883,7 +883,7 @@ LogBloom State::logBloom() const
return ret;
}
void State::commitToMine(BlockChain const& _bc)
void State::commitToMine(BlockChain const& _bc, bytes const& _extraData)
{
uncommitToMine();
@ -966,6 +966,7 @@ void State::commitToMine(BlockChain const& _bc)
m_currentBlock.gasUsed = gasUsed();
m_currentBlock.stateRoot = m_state.root();
m_currentBlock.parentHash = m_previousBlock.hash();
m_currentBlock.extraData = _extraData;
m_committedToMine = true;
}

2
libethereum/State.h

@ -194,7 +194,7 @@ public:
/// The only thing left to do after this is to actually mine().
///
/// This may be called multiple times and without issue.
void commitToMine(BlockChain const& _bc);
void commitToMine(BlockChain const& _bc, bytes const& _extraData = {});
/// @returns true iff commitToMine() has been called without any subsequest transactions added &c.
bool isCommittedToMine() const { return m_committedToMine; }

3
libwebthree/WebThree.cpp

@ -51,7 +51,10 @@ WebThreeDirect::WebThreeDirect(
if (_dbPath.size())
Defaults::setDBPath(_dbPath);
if (_interfaces.count("eth"))
{
m_ethereum.reset(new eth::Client(&m_net, _dbPath, _we, 0));
m_ethereum->setExtraData(rlpList(0, _clientVersion, m_net.id()));
}
if (_interfaces.count("shh"))
m_whisper = m_net.registerCapability<WhisperHost>(new WhisperHost);

Loading…
Cancel
Save