-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1702 introduce PrecompiledConfigPatch
- Loading branch information
1 parent
a348f52
commit 3815c22
Showing
7 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "PrecompiledConfigPatch.h" | ||
|
||
time_t PrecompiledConfigPatch::precompiledConfigPatchTimestamp; | ||
time_t PrecompiledConfigPatch::lastBlockTimestamp; | ||
|
||
bool PrecompiledConfigPatch::isEnabled() { | ||
if ( precompiledConfigPatchTimestamp == 0 ) { | ||
return false; | ||
} | ||
return precompiledConfigPatchTimestamp <= lastBlockTimestamp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef PRECOMPILEDCONFIGPATCH_H | ||
#define PRECOMPILEDCONFIGPATCH_H | ||
|
||
#include <libethereum/SchainPatch.h> | ||
#include <time.h> | ||
|
||
namespace dev { | ||
namespace eth { | ||
class Client; | ||
} | ||
} // namespace dev | ||
|
||
/* | ||
* Context: enable precompiled contracts to read historical config data | ||
*/ | ||
class PrecompiledConfigPatch : public SchainPatch { | ||
public: | ||
static bool isEnabled(); | ||
|
||
static void setTimestamp( time_t _timeStamp ) { | ||
printInfo( __FILE__, _timeStamp ); | ||
precompiledConfigPatchTimestamp = _timeStamp; | ||
} | ||
|
||
private: | ||
friend class dev::eth::Client; | ||
static time_t precompiledConfigPatchTimestamp; | ||
static time_t lastBlockTimestamp; | ||
}; | ||
|
||
|
||
#endif // PRECOMPILEDCONFIGPATCH_H |