Merge remote-tracking branch 'bytecoin/master'
This commit is contained in:
commit
8edd998304
|
@ -1,3 +1,7 @@
|
||||||
|
Release notes 1.1.1
|
||||||
|
|
||||||
|
- New API for CryptoNote RPC Wallet
|
||||||
|
|
||||||
Release notes 1.1.0
|
Release notes 1.1.0
|
||||||
|
|
||||||
- CryptoNote RPC Wallet
|
- CryptoNote RPC Wallet
|
||||||
|
|
2
external/gtest/include/gtest/gtest-spi.h
vendored
2
external/gtest/include/gtest/gtest-spi.h
vendored
|
@ -75,7 +75,7 @@ class GTEST_API_ ScopedFakeTestPartResultReporter
|
||||||
//
|
//
|
||||||
// This method is from the TestPartResultReporterInterface
|
// This method is from the TestPartResultReporterInterface
|
||||||
// interface.
|
// interface.
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
virtual void ReportTestPartResult(const TestPartResult& result) override;
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
|
|
@ -162,8 +162,8 @@ class GTEST_API_ HasNewFatalFailureHelper
|
||||||
: public TestPartResultReporterInterface {
|
: public TestPartResultReporterInterface {
|
||||||
public:
|
public:
|
||||||
HasNewFatalFailureHelper();
|
HasNewFatalFailureHelper();
|
||||||
virtual ~HasNewFatalFailureHelper();
|
virtual ~HasNewFatalFailureHelper() override;
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
virtual void ReportTestPartResult(const TestPartResult& result) override;
|
||||||
bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
|
bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
|
||||||
private:
|
private:
|
||||||
bool has_new_fatal_failure_;
|
bool has_new_fatal_failure_;
|
||||||
|
|
26
external/gtest/include/gtest/gtest.h
vendored
26
external/gtest/include/gtest/gtest.h
vendored
|
@ -1011,21 +1011,21 @@ class TestEventListener {
|
||||||
// above.
|
// above.
|
||||||
class EmptyTestEventListener : public TestEventListener {
|
class EmptyTestEventListener : public TestEventListener {
|
||||||
public:
|
public:
|
||||||
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
|
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
|
virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
|
||||||
int /*iteration*/) {}
|
int /*iteration*/) override {}
|
||||||
virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
|
virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
|
virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
|
virtual void OnTestCaseStart(const TestCase& /*test_case*/) override {}
|
||||||
virtual void OnTestStart(const TestInfo& /*test_info*/) {}
|
virtual void OnTestStart(const TestInfo& /*test_info*/) override {}
|
||||||
virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
|
virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
|
||||||
virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
|
virtual void OnTestEnd(const TestInfo& /*test_info*/) override {}
|
||||||
virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
|
virtual void OnTestCaseEnd(const TestCase& /*test_case*/) override {}
|
||||||
virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
|
virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
|
virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
|
virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
|
||||||
int /*iteration*/) {}
|
int /*iteration*/) override {}
|
||||||
virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
|
virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TestEventListeners lets users add listeners to track events in Google Test.
|
// TestEventListeners lets users add listeners to track events in Google Test.
|
||||||
|
|
|
@ -148,7 +148,7 @@ class DeathTestFactory {
|
||||||
class DefaultDeathTestFactory : public DeathTestFactory {
|
class DefaultDeathTestFactory : public DeathTestFactory {
|
||||||
public:
|
public:
|
||||||
virtual bool Create(const char* statement, const RE* regex,
|
virtual bool Create(const char* statement, const RE* regex,
|
||||||
const char* file, int line, DeathTest** test);
|
const char* file, int line, DeathTest** test) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns true if exit_status describes a process that was terminated
|
// Returns true if exit_status describes a process that was terminated
|
||||||
|
|
|
@ -451,7 +451,7 @@ class TestFactoryBase {
|
||||||
template <class TestClass>
|
template <class TestClass>
|
||||||
class TestFactoryImpl : public TestFactoryBase {
|
class TestFactoryImpl : public TestFactoryBase {
|
||||||
public:
|
public:
|
||||||
virtual Test* CreateTest() { return new TestClass; }
|
virtual Test* CreateTest() override { return new TestClass; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
|
@ -1138,7 +1138,7 @@ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
|
||||||
public:\
|
public:\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
||||||
private:\
|
private:\
|
||||||
virtual void TestBody();\
|
virtual void TestBody() override;\
|
||||||
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
|
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
||||||
|
|
|
@ -270,12 +270,12 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
|
||||||
template <typename ForwardIterator>
|
template <typename ForwardIterator>
|
||||||
ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
|
ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
|
||||||
: container_(begin, end) {}
|
: container_(begin, end) {}
|
||||||
virtual ~ValuesInIteratorRangeGenerator() {}
|
virtual ~ValuesInIteratorRangeGenerator() override {}
|
||||||
|
|
||||||
virtual ParamIteratorInterface<T>* Begin() const {
|
virtual ParamIteratorInterface<T>* Begin() const override {
|
||||||
return new Iterator(this, container_.begin());
|
return new Iterator(this, container_.begin());
|
||||||
}
|
}
|
||||||
virtual ParamIteratorInterface<T>* End() const {
|
virtual ParamIteratorInterface<T>* End() const override {
|
||||||
return new Iterator(this, container_.end());
|
return new Iterator(this, container_.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,16 +287,16 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
|
||||||
Iterator(const ParamGeneratorInterface<T>* base,
|
Iterator(const ParamGeneratorInterface<T>* base,
|
||||||
typename ContainerType::const_iterator iterator)
|
typename ContainerType::const_iterator iterator)
|
||||||
: base_(base), iterator_(iterator) {}
|
: base_(base), iterator_(iterator) {}
|
||||||
virtual ~Iterator() {}
|
virtual ~Iterator() override {}
|
||||||
|
|
||||||
virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
|
virtual const ParamGeneratorInterface<T>* BaseGenerator() const override {
|
||||||
return base_;
|
return base_;
|
||||||
}
|
}
|
||||||
virtual void Advance() {
|
virtual void Advance() override {
|
||||||
++iterator_;
|
++iterator_;
|
||||||
value_.reset();
|
value_.reset();
|
||||||
}
|
}
|
||||||
virtual ParamIteratorInterface<T>* Clone() const {
|
virtual ParamIteratorInterface<T>* Clone() const override {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
// We need to use cached value referenced by iterator_ because *iterator_
|
// We need to use cached value referenced by iterator_ because *iterator_
|
||||||
|
@ -306,12 +306,12 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
|
||||||
// can advance iterator_ beyond the end of the range, and we cannot
|
// can advance iterator_ beyond the end of the range, and we cannot
|
||||||
// detect that fact. The client code, on the other hand, is
|
// detect that fact. The client code, on the other hand, is
|
||||||
// responsible for not calling Current() on an out-of-range iterator.
|
// responsible for not calling Current() on an out-of-range iterator.
|
||||||
virtual const T* Current() const {
|
virtual const T* Current() const override {
|
||||||
if (value_.get() == NULL)
|
if (value_.get() == NULL)
|
||||||
value_.reset(new T(*iterator_));
|
value_.reset(new T(*iterator_));
|
||||||
return value_.get();
|
return value_.get();
|
||||||
}
|
}
|
||||||
virtual bool Equals(const ParamIteratorInterface<T>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<T>& other) const override {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
|
GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
|
||||||
|
@ -355,7 +355,7 @@ class ParameterizedTestFactory : public TestFactoryBase {
|
||||||
typedef typename TestClass::ParamType ParamType;
|
typedef typename TestClass::ParamType ParamType;
|
||||||
explicit ParameterizedTestFactory(ParamType parameter) :
|
explicit ParameterizedTestFactory(ParamType parameter) :
|
||||||
parameter_(parameter) {}
|
parameter_(parameter) {}
|
||||||
virtual Test* CreateTest() {
|
virtual Test* CreateTest() override {
|
||||||
TestClass::SetParam(¶meter_);
|
TestClass::SetParam(¶meter_);
|
||||||
return new TestClass();
|
return new TestClass();
|
||||||
}
|
}
|
||||||
|
@ -454,9 +454,9 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
|
||||||
: test_case_name_(name) {}
|
: test_case_name_(name) {}
|
||||||
|
|
||||||
// Test case base name for display purposes.
|
// Test case base name for display purposes.
|
||||||
virtual const string& GetTestCaseName() const { return test_case_name_; }
|
virtual const string& GetTestCaseName() const override { return test_case_name_; }
|
||||||
// Test case id to verify identity.
|
// Test case id to verify identity.
|
||||||
virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
|
virtual TypeId GetTestCaseTypeId() const override { return GetTypeId<TestCase>(); }
|
||||||
// TEST_P macro uses AddTestPattern() to record information
|
// TEST_P macro uses AddTestPattern() to record information
|
||||||
// about a single test in a LocalTestInfo structure.
|
// about a single test in a LocalTestInfo structure.
|
||||||
// test_case_name is the base name of the test case (without invocation
|
// test_case_name is the base name of the test case (without invocation
|
||||||
|
@ -484,7 +484,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
|
||||||
// This method should not be called more then once on any single
|
// This method should not be called more then once on any single
|
||||||
// instance of a ParameterizedTestCaseInfoBase derived class.
|
// instance of a ParameterizedTestCaseInfoBase derived class.
|
||||||
// UnitTest has a guard to prevent from calling this method more then once.
|
// UnitTest has a guard to prevent from calling this method more then once.
|
||||||
virtual void RegisterTests() {
|
virtual void RegisterTests() override {
|
||||||
for (typename TestInfoContainer::iterator test_it = tests_.begin();
|
for (typename TestInfoContainer::iterator test_it = tests_.begin();
|
||||||
test_it != tests_.end(); ++test_it) {
|
test_it != tests_.end(); ++test_it) {
|
||||||
linked_ptr<TestInfo> test_info = *test_it;
|
linked_ptr<TestInfo> test_info = *test_it;
|
||||||
|
|
|
@ -1296,7 +1296,7 @@ class ThreadWithParam : public ThreadWithParamBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Run() {
|
virtual void Run() override {
|
||||||
if (thread_can_start_ != NULL)
|
if (thread_can_start_ != NULL)
|
||||||
thread_can_start_->WaitForNotification();
|
thread_can_start_->WaitForNotification();
|
||||||
func_(param_);
|
func_(param_);
|
||||||
|
|
10
external/gtest/src/gtest-death-test.cc
vendored
10
external/gtest/src/gtest-death-test.cc
vendored
|
@ -373,8 +373,8 @@ class DeathTestImpl : public DeathTest {
|
||||||
// read_fd_ is expected to be closed and cleared by a derived class.
|
// read_fd_ is expected to be closed and cleared by a derived class.
|
||||||
~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
|
~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
|
||||||
|
|
||||||
void Abort(AbortReason reason);
|
void Abort(AbortReason reason) override;
|
||||||
virtual bool Passed(bool status_ok);
|
virtual bool Passed(bool status_ok) override;
|
||||||
|
|
||||||
const char* statement() const { return statement_; }
|
const char* statement() const { return statement_; }
|
||||||
const RE* regex() const { return regex_; }
|
const RE* regex() const { return regex_; }
|
||||||
|
@ -778,7 +778,7 @@ class ForkingDeathTest : public DeathTestImpl {
|
||||||
ForkingDeathTest(const char* statement, const RE* regex);
|
ForkingDeathTest(const char* statement, const RE* regex);
|
||||||
|
|
||||||
// All of these virtual functions are inherited from DeathTest.
|
// All of these virtual functions are inherited from DeathTest.
|
||||||
virtual int Wait();
|
virtual int Wait() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
|
void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
|
||||||
|
@ -814,7 +814,7 @@ class NoExecDeathTest : public ForkingDeathTest {
|
||||||
public:
|
public:
|
||||||
NoExecDeathTest(const char* a_statement, const RE* a_regex) :
|
NoExecDeathTest(const char* a_statement, const RE* a_regex) :
|
||||||
ForkingDeathTest(a_statement, a_regex) { }
|
ForkingDeathTest(a_statement, a_regex) { }
|
||||||
virtual TestRole AssumeRole();
|
virtual TestRole AssumeRole() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The AssumeRole process for a fork-and-run death test. It implements a
|
// The AssumeRole process for a fork-and-run death test. It implements a
|
||||||
|
@ -870,7 +870,7 @@ class ExecDeathTest : public ForkingDeathTest {
|
||||||
ExecDeathTest(const char* a_statement, const RE* a_regex,
|
ExecDeathTest(const char* a_statement, const RE* a_regex,
|
||||||
const char* file, int line) :
|
const char* file, int line) :
|
||||||
ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
|
ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
|
||||||
virtual TestRole AssumeRole();
|
virtual TestRole AssumeRole() override;
|
||||||
private:
|
private:
|
||||||
static ::std::vector<testing::internal::string>
|
static ::std::vector<testing::internal::string>
|
||||||
GetArgvsForDeathTestChildProcess() {
|
GetArgvsForDeathTestChildProcess() {
|
||||||
|
|
30
external/gtest/src/gtest-internal-inl.h
vendored
30
external/gtest/src/gtest-internal-inl.h
vendored
|
@ -441,10 +441,10 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
|
||||||
public:
|
public:
|
||||||
OsStackTraceGetter() : caller_frame_(NULL) {}
|
OsStackTraceGetter() : caller_frame_(NULL) {}
|
||||||
|
|
||||||
virtual string CurrentStackTrace(int max_depth, int skip_count)
|
virtual string CurrentStackTrace(int max_depth, int skip_count) override
|
||||||
GTEST_LOCK_EXCLUDED_(mutex_);
|
GTEST_LOCK_EXCLUDED_(mutex_);
|
||||||
|
|
||||||
virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
|
virtual void UponLeavingGTest() override GTEST_LOCK_EXCLUDED_(mutex_);
|
||||||
|
|
||||||
// This string is inserted in place of stack frames that are part of
|
// This string is inserted in place of stack frames that are part of
|
||||||
// Google Test's implementation.
|
// Google Test's implementation.
|
||||||
|
@ -477,7 +477,7 @@ class DefaultGlobalTestPartResultReporter
|
||||||
explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
|
explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
|
||||||
// Implements the TestPartResultReporterInterface. Reports the test part
|
// Implements the TestPartResultReporterInterface. Reports the test part
|
||||||
// result in the current test.
|
// result in the current test.
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
virtual void ReportTestPartResult(const TestPartResult& result) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UnitTestImpl* const unit_test_;
|
UnitTestImpl* const unit_test_;
|
||||||
|
@ -493,7 +493,7 @@ class DefaultPerThreadTestPartResultReporter
|
||||||
explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
|
explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
|
||||||
// Implements the TestPartResultReporterInterface. The implementation just
|
// Implements the TestPartResultReporterInterface. The implementation just
|
||||||
// delegates to the current global test part result reporter of *unit_test_.
|
// delegates to the current global test part result reporter of *unit_test_.
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
virtual void ReportTestPartResult(const TestPartResult& result) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UnitTestImpl* const unit_test_;
|
UnitTestImpl* const unit_test_;
|
||||||
|
@ -1100,7 +1100,7 @@ class StreamingListener : public EmptyTestEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends a string to the socket.
|
// Sends a string to the socket.
|
||||||
virtual void Send(const string& message) {
|
virtual void Send(const string& message) override {
|
||||||
GTEST_CHECK_(sockfd_ != -1)
|
GTEST_CHECK_(sockfd_ != -1)
|
||||||
<< "Send() can be called only when there is a connection.";
|
<< "Send() can be called only when there is a connection.";
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ class StreamingListener : public EmptyTestEventListener {
|
||||||
void MakeConnection();
|
void MakeConnection();
|
||||||
|
|
||||||
// Closes the socket.
|
// Closes the socket.
|
||||||
void CloseConnection() {
|
void CloseConnection() override {
|
||||||
GTEST_CHECK_(sockfd_ != -1)
|
GTEST_CHECK_(sockfd_ != -1)
|
||||||
<< "CloseConnection() can be called only when there is a connection.";
|
<< "CloseConnection() can be called only when there is a connection.";
|
||||||
|
|
||||||
|
@ -1141,11 +1141,11 @@ class StreamingListener : public EmptyTestEventListener {
|
||||||
explicit StreamingListener(AbstractSocketWriter* socket_writer)
|
explicit StreamingListener(AbstractSocketWriter* socket_writer)
|
||||||
: socket_writer_(socket_writer) { Start(); }
|
: socket_writer_(socket_writer) { Start(); }
|
||||||
|
|
||||||
void OnTestProgramStart(const UnitTest& /* unit_test */) {
|
void OnTestProgramStart(const UnitTest& /* unit_test */) override {
|
||||||
SendLn("event=TestProgramStart");
|
SendLn("event=TestProgramStart");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestProgramEnd(const UnitTest& unit_test) {
|
void OnTestProgramEnd(const UnitTest& unit_test) override {
|
||||||
// Note that Google Test current only report elapsed time for each
|
// Note that Google Test current only report elapsed time for each
|
||||||
// test iteration, not for the entire test program.
|
// test iteration, not for the entire test program.
|
||||||
SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
|
SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
|
||||||
|
@ -1154,39 +1154,39 @@ class StreamingListener : public EmptyTestEventListener {
|
||||||
socket_writer_->CloseConnection();
|
socket_writer_->CloseConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
|
void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) override {
|
||||||
SendLn("event=TestIterationStart&iteration=" +
|
SendLn("event=TestIterationStart&iteration=" +
|
||||||
StreamableToString(iteration));
|
StreamableToString(iteration));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
|
void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) override {
|
||||||
SendLn("event=TestIterationEnd&passed=" +
|
SendLn("event=TestIterationEnd&passed=" +
|
||||||
FormatBool(unit_test.Passed()) + "&elapsed_time=" +
|
FormatBool(unit_test.Passed()) + "&elapsed_time=" +
|
||||||
StreamableToString(unit_test.elapsed_time()) + "ms");
|
StreamableToString(unit_test.elapsed_time()) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestCaseStart(const TestCase& test_case) {
|
void OnTestCaseStart(const TestCase& test_case) override {
|
||||||
SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
|
SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestCaseEnd(const TestCase& test_case) {
|
void OnTestCaseEnd(const TestCase& test_case) override {
|
||||||
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
|
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
|
||||||
+ "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
|
+ "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
|
||||||
+ "ms");
|
+ "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestStart(const TestInfo& test_info) {
|
void OnTestStart(const TestInfo& test_info) override {
|
||||||
SendLn(std::string("event=TestStart&name=") + test_info.name());
|
SendLn(std::string("event=TestStart&name=") + test_info.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestEnd(const TestInfo& test_info) {
|
void OnTestEnd(const TestInfo& test_info) override {
|
||||||
SendLn("event=TestEnd&passed=" +
|
SendLn("event=TestEnd&passed=" +
|
||||||
FormatBool((test_info.result())->Passed()) +
|
FormatBool((test_info.result())->Passed()) +
|
||||||
"&elapsed_time=" +
|
"&elapsed_time=" +
|
||||||
StreamableToString((test_info.result())->elapsed_time()) + "ms");
|
StreamableToString((test_info.result())->elapsed_time()) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTestPartResult(const TestPartResult& test_part_result) {
|
void OnTestPartResult(const TestPartResult& test_part_result) override {
|
||||||
const char* file_name = test_part_result.file_name();
|
const char* file_name = test_part_result.file_name();
|
||||||
if (file_name == NULL)
|
if (file_name == NULL)
|
||||||
file_name = "";
|
file_name = "";
|
||||||
|
|
54
external/gtest/src/gtest.cc
vendored
54
external/gtest/src/gtest.cc
vendored
|
@ -2697,19 +2697,19 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following methods override what's in the TestEventListener class.
|
// The following methods override what's in the TestEventListener class.
|
||||||
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
|
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
|
virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration) override;
|
||||||
virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
|
virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override;
|
||||||
virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
|
virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnTestCaseStart(const TestCase& test_case);
|
virtual void OnTestCaseStart(const TestCase& test_case) override;
|
||||||
virtual void OnTestStart(const TestInfo& test_info);
|
virtual void OnTestStart(const TestInfo& test_info) override;
|
||||||
virtual void OnTestPartResult(const TestPartResult& result);
|
virtual void OnTestPartResult(const TestPartResult& result) override;
|
||||||
virtual void OnTestEnd(const TestInfo& test_info);
|
virtual void OnTestEnd(const TestInfo& test_info) override;
|
||||||
virtual void OnTestCaseEnd(const TestCase& test_case);
|
virtual void OnTestCaseEnd(const TestCase& test_case) override;
|
||||||
virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
|
virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override;
|
||||||
virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
|
virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
|
||||||
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
|
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
|
||||||
virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
|
virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void PrintFailedTests(const UnitTest& unit_test);
|
static void PrintFailedTests(const UnitTest& unit_test);
|
||||||
|
@ -2908,19 +2908,19 @@ class TestEventRepeater : public TestEventListener {
|
||||||
bool forwarding_enabled() const { return forwarding_enabled_; }
|
bool forwarding_enabled() const { return forwarding_enabled_; }
|
||||||
void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
|
void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
|
||||||
|
|
||||||
virtual void OnTestProgramStart(const UnitTest& unit_test);
|
virtual void OnTestProgramStart(const UnitTest& unit_test) override;
|
||||||
virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
|
virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration) override;
|
||||||
virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
|
virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override;
|
||||||
virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
|
virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) override;
|
||||||
virtual void OnTestCaseStart(const TestCase& test_case);
|
virtual void OnTestCaseStart(const TestCase& test_case) override;
|
||||||
virtual void OnTestStart(const TestInfo& test_info);
|
virtual void OnTestStart(const TestInfo& test_info) override;
|
||||||
virtual void OnTestPartResult(const TestPartResult& result);
|
virtual void OnTestPartResult(const TestPartResult& result) override;
|
||||||
virtual void OnTestEnd(const TestInfo& test_info);
|
virtual void OnTestEnd(const TestInfo& test_info) override;
|
||||||
virtual void OnTestCaseEnd(const TestCase& test_case);
|
virtual void OnTestCaseEnd(const TestCase& test_case) override;
|
||||||
virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
|
virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override;
|
||||||
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
|
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) override;
|
||||||
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
|
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
|
||||||
virtual void OnTestProgramEnd(const UnitTest& unit_test);
|
virtual void OnTestProgramEnd(const UnitTest& unit_test) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Controls whether events will be forwarded to listeners_. Set to false
|
// Controls whether events will be forwarded to listeners_. Set to false
|
||||||
|
@ -3013,7 +3013,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
|
||||||
public:
|
public:
|
||||||
explicit XmlUnitTestResultPrinter(const char* output_file);
|
explicit XmlUnitTestResultPrinter(const char* output_file);
|
||||||
|
|
||||||
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
|
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Is c a whitespace character that is normalized to a space character
|
// Is c a whitespace character that is normalized to a space character
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -84,7 +84,8 @@ public:
|
||||||
virtual size_t transactionsCount() const = 0;
|
virtual size_t transactionsCount() const = 0;
|
||||||
virtual uint64_t balance(uint32_t flags = IncludeDefault) const = 0;
|
virtual uint64_t balance(uint32_t flags = IncludeDefault) const = 0;
|
||||||
virtual void getOutputs(std::vector<TransactionOutputInformation>& transfers, uint32_t flags = IncludeDefault) const = 0;
|
virtual void getOutputs(std::vector<TransactionOutputInformation>& transfers, uint32_t flags = IncludeDefault) const = 0;
|
||||||
virtual bool getTransactionInformation(const Crypto::Hash& transactionHash, TransactionInformation& info, int64_t& txBalance) const = 0;
|
virtual bool getTransactionInformation(const Crypto::Hash& transactionHash, TransactionInformation& info,
|
||||||
|
uint64_t* amountIn = nullptr, uint64_t* amountOut = nullptr) const = 0;
|
||||||
virtual std::vector<TransactionOutputInformation> getTransactionOutputs(const Crypto::Hash& transactionHash, uint32_t flags = IncludeDefault) const = 0;
|
virtual std::vector<TransactionOutputInformation> getTransactionOutputs(const Crypto::Hash& transactionHash, uint32_t flags = IncludeDefault) const = 0;
|
||||||
//only type flags are feasible for this function
|
//only type flags are feasible for this function
|
||||||
virtual std::vector<TransactionOutputInformation> getTransactionInputs(const Crypto::Hash& transactionHash, uint32_t flags) const = 0;
|
virtual std::vector<TransactionOutputInformation> getTransactionInputs(const Crypto::Hash& transactionHash, uint32_t flags) const = 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -49,6 +49,16 @@ public:
|
||||||
virtual ITransfersContainer& getContainer() = 0;
|
virtual ITransfersContainer& getContainer() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ITransfersSynchronizerObserver {
|
||||||
|
public:
|
||||||
|
virtual void onBlocksAdded(const Crypto::PublicKey& viewPublicKey, const std::vector<Crypto::Hash>& blockHashes) {}
|
||||||
|
virtual void onBlockchainDetach(const Crypto::PublicKey& viewPublicKey, uint32_t blockIndex) {}
|
||||||
|
virtual void onTransactionDeleteBegin(const Crypto::PublicKey& viewPublicKey, Crypto::Hash transactionHash) {}
|
||||||
|
virtual void onTransactionDeleteEnd(const Crypto::PublicKey& viewPublicKey, Crypto::Hash transactionHash) {}
|
||||||
|
virtual void onTransactionUpdated(const Crypto::PublicKey& viewPublicKey, const Crypto::Hash& transactionHash,
|
||||||
|
const std::vector<ITransfersContainer*>& containers) {}
|
||||||
|
};
|
||||||
|
|
||||||
class ITransfersSynchronizer : public IStreamSerializable {
|
class ITransfersSynchronizer : public IStreamSerializable {
|
||||||
public:
|
public:
|
||||||
virtual ~ITransfersSynchronizer() {}
|
virtual ~ITransfersSynchronizer() {}
|
||||||
|
@ -58,6 +68,7 @@ public:
|
||||||
virtual void getSubscriptions(std::vector<AccountPublicAddress>& subscriptions) = 0;
|
virtual void getSubscriptions(std::vector<AccountPublicAddress>& subscriptions) = 0;
|
||||||
// returns nullptr if address is not found
|
// returns nullptr if address is not found
|
||||||
virtual ITransfersSubscription* getSubscription(const AccountPublicAddress& acc) = 0;
|
virtual ITransfersSubscription* getSubscription(const AccountPublicAddress& acc) = 0;
|
||||||
|
virtual std::vector<Crypto::Hash> getViewKeyKnownBlocks(const Crypto::PublicKey& publicViewKey) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@ const uint32_t WALLET_UNCONFIRMED_TRANSACTION_HEIGHT = std::numeric_limits<uint3
|
||||||
enum class WalletTransactionState : uint8_t {
|
enum class WalletTransactionState : uint8_t {
|
||||||
SUCCEEDED = 0,
|
SUCCEEDED = 0,
|
||||||
FAILED,
|
FAILED,
|
||||||
CANCELLED
|
CANCELLED,
|
||||||
|
CREATED,
|
||||||
|
DELETED
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WalletEventType {
|
enum WalletEventType {
|
||||||
|
@ -26,7 +28,7 @@ enum WalletEventType {
|
||||||
TRANSACTION_UPDATED,
|
TRANSACTION_UPDATED,
|
||||||
BALANCE_UNLOCKED,
|
BALANCE_UNLOCKED,
|
||||||
SYNC_PROGRESS_UPDATED,
|
SYNC_PROGRESS_UPDATED,
|
||||||
SYNC_COMPLETED
|
SYNC_COMPLETED,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WalletTransactionCreatedData {
|
struct WalletTransactionCreatedData {
|
||||||
|
@ -64,11 +66,49 @@ struct WalletTransaction {
|
||||||
bool isBase;
|
bool isBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class WalletTransferType : uint8_t {
|
||||||
|
USUAL = 0,
|
||||||
|
DONATION,
|
||||||
|
CHANGE
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WalletOrder {
|
||||||
|
std::string address;
|
||||||
|
uint64_t amount;
|
||||||
|
};
|
||||||
|
|
||||||
struct WalletTransfer {
|
struct WalletTransfer {
|
||||||
|
WalletTransferType type;
|
||||||
std::string address;
|
std::string address;
|
||||||
int64_t amount;
|
int64_t amount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DonationSettings {
|
||||||
|
std::string address;
|
||||||
|
uint64_t threshold = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransactionParameters {
|
||||||
|
std::vector<std::string> sourceAddresses;
|
||||||
|
std::vector<WalletOrder> destinations;
|
||||||
|
uint64_t fee = 0;
|
||||||
|
uint64_t mixIn = 0;
|
||||||
|
std::string extra;
|
||||||
|
uint64_t unlockTimestamp = 0;
|
||||||
|
DonationSettings donation;
|
||||||
|
std::string changeDestination;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WalletTransactionWithTransfers {
|
||||||
|
WalletTransaction transaction;
|
||||||
|
std::vector<WalletTransfer> transfers;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransactionsInBlockInfo {
|
||||||
|
Crypto::Hash blockHash;
|
||||||
|
std::vector<WalletTransactionWithTransfers> transactions;
|
||||||
|
};
|
||||||
|
|
||||||
class IWallet {
|
class IWallet {
|
||||||
public:
|
public:
|
||||||
virtual ~IWallet() {}
|
virtual ~IWallet() {}
|
||||||
|
@ -84,6 +124,7 @@ public:
|
||||||
virtual size_t getAddressCount() const = 0;
|
virtual size_t getAddressCount() const = 0;
|
||||||
virtual std::string getAddress(size_t index) const = 0;
|
virtual std::string getAddress(size_t index) const = 0;
|
||||||
virtual KeyPair getAddressSpendKey(size_t index) const = 0;
|
virtual KeyPair getAddressSpendKey(size_t index) const = 0;
|
||||||
|
virtual KeyPair getAddressSpendKey(const std::string& address) const = 0;
|
||||||
virtual KeyPair getViewKey() const = 0;
|
virtual KeyPair getViewKey() const = 0;
|
||||||
virtual std::string createAddress() = 0;
|
virtual std::string createAddress() = 0;
|
||||||
virtual std::string createAddress(const Crypto::SecretKey& spendSecretKey) = 0;
|
virtual std::string createAddress(const Crypto::SecretKey& spendSecretKey) = 0;
|
||||||
|
@ -100,10 +141,19 @@ public:
|
||||||
virtual size_t getTransactionTransferCount(size_t transactionIndex) const = 0;
|
virtual size_t getTransactionTransferCount(size_t transactionIndex) const = 0;
|
||||||
virtual WalletTransfer getTransactionTransfer(size_t transactionIndex, size_t transferIndex) const = 0;
|
virtual WalletTransfer getTransactionTransfer(size_t transactionIndex, size_t transferIndex) const = 0;
|
||||||
|
|
||||||
virtual size_t transfer(const WalletTransfer& destination, uint64_t fee, uint64_t mixIn = 0, const std::string& extra = "", uint64_t unlockTimestamp = 0) = 0;
|
virtual WalletTransactionWithTransfers getTransaction(const Crypto::Hash& transactionHash) const = 0;
|
||||||
virtual size_t transfer(const std::vector<WalletTransfer>& destinations, uint64_t fee, uint64_t mixIn = 0, const std::string& extra = "", uint64_t unlockTimestamp = 0) = 0;
|
virtual std::vector<TransactionsInBlockInfo> getTransactions(const Crypto::Hash& blockHash, size_t count) const = 0;
|
||||||
virtual size_t transfer(const std::string& sourceAddress, const WalletTransfer& destination, uint64_t fee, uint64_t mixIn = 0, const std::string& extra = "", uint64_t unlockTimestamp = 0) = 0;
|
virtual std::vector<TransactionsInBlockInfo> getTransactions(uint32_t blockIndex, size_t count) const = 0;
|
||||||
virtual size_t transfer(const std::string& sourceAddress, const std::vector<WalletTransfer>& destinations, uint64_t fee, uint64_t mixIn = 0, const std::string& extra = "", uint64_t unlockTimestamp = 0) = 0;
|
virtual std::vector<Crypto::Hash> getBlockHashes(uint32_t blockIndex, size_t count) const = 0;
|
||||||
|
virtual uint32_t getBlockCount() const = 0;
|
||||||
|
virtual std::vector<WalletTransactionWithTransfers> getUnconfirmedTransactions() const = 0;
|
||||||
|
virtual std::vector<size_t> getDelayedTransactionIds() const = 0;
|
||||||
|
|
||||||
|
virtual size_t transfer(const TransactionParameters& sendingTransaction) = 0;
|
||||||
|
|
||||||
|
virtual size_t makeTransaction(const TransactionParameters& sendingTransaction) = 0;
|
||||||
|
virtual void commitTransaction(size_t transactionId) = 0;
|
||||||
|
virtual void rollbackUncommitedTransaction(size_t transactionId) = 0;
|
||||||
|
|
||||||
virtual void start() = 0;
|
virtual void start() = 0;
|
||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -65,12 +65,76 @@ private:
|
||||||
const std::function<void(const INode::Callback&)> requestFunc;
|
const std::function<void(const INode::Callback&)> requestFunc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BlockchainExplorer::PoolUpdateGuard::PoolUpdateGuard() :
|
||||||
|
m_state(State::NONE) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BlockchainExplorer::PoolUpdateGuard::beginUpdate() {
|
||||||
|
auto state = m_state.load();
|
||||||
|
for (;;) {
|
||||||
|
switch (state) {
|
||||||
|
case State::NONE:
|
||||||
|
if (m_state.compare_exchange_weak(state, State::UPDATING)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case State::UPDATING:
|
||||||
|
if (m_state.compare_exchange_weak(state, State::UPDATE_REQUIRED)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case State::UPDATE_REQUIRED:
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BlockchainExplorer::PoolUpdateGuard::endUpdate() {
|
||||||
|
auto state = m_state.load();
|
||||||
|
for (;;) {
|
||||||
|
assert(state != State::NONE);
|
||||||
|
|
||||||
|
if (m_state.compare_exchange_weak(state, State::NONE)) {
|
||||||
|
return state == State::UPDATE_REQUIRED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ScopeExitHandler {
|
||||||
|
public:
|
||||||
|
ScopeExitHandler(std::function<void()>&& handler) :
|
||||||
|
m_handler(std::move(handler)),
|
||||||
|
m_cancelled(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopeExitHandler() {
|
||||||
|
if (!m_cancelled) {
|
||||||
|
m_handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
m_cancelled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<void()> m_handler;
|
||||||
|
bool m_cancelled;
|
||||||
|
};
|
||||||
|
|
||||||
BlockchainExplorer::BlockchainExplorer(INode& node, Logging::ILogger& logger) :
|
BlockchainExplorer::BlockchainExplorer(INode& node, Logging::ILogger& logger) :
|
||||||
node(node),
|
node(node),
|
||||||
logger(logger, "BlockchainExplorer"),
|
logger(logger, "BlockchainExplorer"),
|
||||||
state(NOT_INITIALIZED),
|
state(NOT_INITIALIZED),
|
||||||
synchronized(false),
|
synchronized(false),
|
||||||
observersCounter(0) {}
|
observersCounter(0) {
|
||||||
|
}
|
||||||
|
|
||||||
BlockchainExplorer::~BlockchainExplorer() {}
|
BlockchainExplorer::~BlockchainExplorer() {}
|
||||||
|
|
||||||
|
@ -416,6 +480,12 @@ void BlockchainExplorer::poolChanged() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!poolUpdateGuard.beginUpdate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopeExitHandler poolUpdateEndGuard(std::bind(&BlockchainExplorer::poolUpdateEndHandler, this));
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(mutex);
|
std::unique_lock<std::mutex> lock(mutex);
|
||||||
|
|
||||||
std::shared_ptr<std::vector<std::unique_ptr<ITransactionReader>>> rawNewTransactionsPtr = std::make_shared<std::vector<std::unique_ptr<ITransactionReader>>>();
|
std::shared_ptr<std::vector<std::unique_ptr<ITransactionReader>>> rawNewTransactionsPtr = std::make_shared<std::vector<std::unique_ptr<ITransactionReader>>>();
|
||||||
|
@ -438,8 +508,11 @@ void BlockchainExplorer::poolChanged() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
request.performAsync(asyncContextCounter,
|
request.performAsync(asyncContextCounter,
|
||||||
[this, rawNewTransactionsPtr, removedTransactionsPtr, isBlockchainActualPtr](std::error_code ec) {
|
[this, rawNewTransactionsPtr, removedTransactionsPtr, isBlockchainActualPtr](std::error_code ec) {
|
||||||
|
ScopeExitHandler poolUpdateEndGuard(std::bind(&BlockchainExplorer::poolUpdateEndHandler, this));
|
||||||
|
|
||||||
if (ec) {
|
if (ec) {
|
||||||
logger(ERROR) << "Can't send poolChanged notification because can't get pool symmetric difference: " << ec.message();
|
logger(ERROR) << "Can't send poolChanged notification because can't get pool symmetric difference: " << ec.message();
|
||||||
return;
|
return;
|
||||||
|
@ -461,12 +534,10 @@ void BlockchainExplorer::poolChanged() {
|
||||||
for (const Hash hash : *removedTransactionsPtr) {
|
for (const Hash hash : *removedTransactionsPtr) {
|
||||||
auto iter = knownPoolState.find(hash);
|
auto iter = knownPoolState.find(hash);
|
||||||
if (iter != knownPoolState.end()) {
|
if (iter != knownPoolState.end()) {
|
||||||
removedTransactionsHashesPtr->push_back(
|
removedTransactionsHashesPtr->push_back({
|
||||||
std::move(std::make_pair(
|
hash,
|
||||||
hash,
|
TransactionRemoveReason::INCLUDED_IN_BLOCK // Can't have real reason here.
|
||||||
TransactionRemoveReason::INCLUDED_IN_BLOCK //Can't have real reason here.
|
});
|
||||||
))
|
|
||||||
);
|
|
||||||
knownPoolState.erase(iter);
|
knownPoolState.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,21 +558,34 @@ void BlockchainExplorer::poolChanged() {
|
||||||
std::placeholders::_1
|
std::placeholders::_1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
request.performAsync(asyncContextCounter,
|
request.performAsync(asyncContextCounter,
|
||||||
[this, newTransactionsHashesPtr, newTransactionsPtr, removedTransactionsHashesPtr](std::error_code ec) {
|
[this, newTransactionsHashesPtr, newTransactionsPtr, removedTransactionsHashesPtr](std::error_code ec) {
|
||||||
|
ScopeExitHandler poolUpdateEndGuard(std::bind(&BlockchainExplorer::poolUpdateEndHandler, this));
|
||||||
|
|
||||||
if (ec) {
|
if (ec) {
|
||||||
logger(ERROR) << "Can't send poolChanged notification because can't get transactions: " << ec.message();
|
logger(ERROR) << "Can't send poolChanged notification because can't get transactions: " << ec.message();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newTransactionsPtr->empty() || !removedTransactionsHashesPtr->empty()) {
|
if (!newTransactionsPtr->empty() || !removedTransactionsHashesPtr->empty()) {
|
||||||
observerManager.notify(&IBlockchainObserver::poolUpdated, *newTransactionsPtr, *removedTransactionsHashesPtr);
|
observerManager.notify(&IBlockchainObserver::poolUpdated, *newTransactionsPtr, *removedTransactionsHashesPtr);
|
||||||
logger(DEBUGGING) << "poolUpdated notification was successfully sent.";
|
logger(DEBUGGING) << "poolUpdated notification was successfully sent.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
poolUpdateEndGuard.reset();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
poolUpdateEndGuard.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockchainExplorer::poolUpdateEndHandler() {
|
||||||
|
if (poolUpdateGuard.endUpdate()) {
|
||||||
|
poolChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockchainExplorer::blockchainSynchronized(uint32_t topHeight) {
|
void BlockchainExplorer::blockchainSynchronized(uint32_t topHeight) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -61,6 +61,25 @@ public:
|
||||||
typedef WalletAsyncContextCounter AsyncContextCounter;
|
typedef WalletAsyncContextCounter AsyncContextCounter;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void poolUpdateEndHandler();
|
||||||
|
|
||||||
|
class PoolUpdateGuard {
|
||||||
|
public:
|
||||||
|
PoolUpdateGuard();
|
||||||
|
|
||||||
|
bool beginUpdate();
|
||||||
|
bool endUpdate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum class State {
|
||||||
|
NONE,
|
||||||
|
UPDATING,
|
||||||
|
UPDATE_REQUIRED
|
||||||
|
};
|
||||||
|
|
||||||
|
std::atomic<State> m_state;
|
||||||
|
};
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
NOT_INITIALIZED,
|
NOT_INITIALIZED,
|
||||||
INITIALIZED
|
INITIALIZED
|
||||||
|
@ -81,6 +100,6 @@ private:
|
||||||
Logging::LoggerRef logger;
|
Logging::LoggerRef logger;
|
||||||
|
|
||||||
AsyncContextCounter asyncContextCounter;
|
AsyncContextCounter asyncContextCounter;
|
||||||
|
PoolUpdateGuard poolUpdateGuard;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ bool BlockchainExplorerDataBuilder::fillTxExtra(const std::vector<uint8_t>& rawE
|
||||||
} else if (typeid(TransactionExtraPublicKey) == field.type()) {
|
} else if (typeid(TransactionExtraPublicKey) == field.type()) {
|
||||||
extraDetails.publicKey.push_back(std::move(boost::get<TransactionExtraPublicKey>(field).publicKey));
|
extraDetails.publicKey.push_back(std::move(boost::get<TransactionExtraPublicKey>(field).publicKey));
|
||||||
} else if (typeid(TransactionExtraNonce) == field.type()) {
|
} else if (typeid(TransactionExtraNonce) == field.type()) {
|
||||||
extraDetails.nonce.push_back(std::move(Common::toHex(boost::get<TransactionExtraNonce>(field).nonce.data(), boost::get<TransactionExtraNonce>(field).nonce.size())));
|
extraDetails.nonce.push_back(Common::toHex(boost::get<TransactionExtraNonce>(field).nonce.data(), boost::get<TransactionExtraNonce>(field).nonce.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -21,15 +21,15 @@ class BlockchainExplorerErrorCategory : public std::error_category {
|
||||||
public:
|
public:
|
||||||
static BlockchainExplorerErrorCategory INSTANCE;
|
static BlockchainExplorerErrorCategory INSTANCE;
|
||||||
|
|
||||||
virtual const char* name() const throw() {
|
virtual const char* name() const throw() override {
|
||||||
return "BlockchainExplorerErrorCategory";
|
return "BlockchainExplorerErrorCategory";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::error_condition default_error_condition(int ev) const throw() {
|
virtual std::error_condition default_error_condition(int ev) const throw() override {
|
||||||
return std::error_condition(ev, *this);
|
return std::error_condition(ev, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string message(int ev) const {
|
virtual std::string message(int ev) const override {
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case static_cast<int>(BlockchainExplorerErrorCodes::NOT_INITIALIZED): return "Object was not initialized";
|
case static_cast<int>(BlockchainExplorerErrorCodes::NOT_INITIALIZED): return "Object was not initialized";
|
||||||
case static_cast<int>(BlockchainExplorerErrorCodes::ALREADY_INITIALIZED): return "Object has been already initialized";
|
case static_cast<int>(BlockchainExplorerErrorCodes::ALREADY_INITIALIZED): return "Object has been already initialized";
|
||||||
|
|
|
@ -30,6 +30,7 @@ file(GLOB_RECURSE JsonRpcServer JsonRpcServer/*)
|
||||||
|
|
||||||
file(GLOB_RECURSE PaymentGate PaymentGate/*)
|
file(GLOB_RECURSE PaymentGate PaymentGate/*)
|
||||||
file(GLOB_RECURSE PaymentGateService PaymentGateService/*)
|
file(GLOB_RECURSE PaymentGateService PaymentGateService/*)
|
||||||
|
file(GLOB_RECURSE Miner Miner/*)
|
||||||
|
|
||||||
source_group("" FILES $${Common} ${ConnectivityTool} ${Crypto} ${CryptoNoteCore} ${CryptoNoteProtocol} ${Daemon} ${JsonRpcServer} ${Http} ${Logging} ${NodeRpcProxy} ${P2p} ${Rpc} ${Serialization} ${SimpleWallet} ${System} ${Transfers} ${Wallet} ${WalletLegacy})
|
source_group("" FILES $${Common} ${ConnectivityTool} ${Crypto} ${CryptoNoteCore} ${CryptoNoteProtocol} ${Daemon} ${JsonRpcServer} ${Http} ${Logging} ${NodeRpcProxy} ${P2p} ${Rpc} ${Serialization} ${SimpleWallet} ${System} ${Transfers} ${Wallet} ${WalletLegacy})
|
||||||
|
|
||||||
|
@ -54,17 +55,17 @@ add_executable(ConnectivityTool ${ConnectivityTool})
|
||||||
add_executable(Daemon ${Daemon})
|
add_executable(Daemon ${Daemon})
|
||||||
add_executable(SimpleWallet ${SimpleWallet})
|
add_executable(SimpleWallet ${SimpleWallet})
|
||||||
add_executable(PaymentGateService ${PaymentGateService})
|
add_executable(PaymentGateService ${PaymentGateService})
|
||||||
|
add_executable(Miner ${Miner})
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
target_link_libraries(System ws2_32)
|
||||||
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(ConnectivityTool CryptoNoteCore Common Logging Crypto P2P Rpc Http Serialization System ${Boost_LIBRARIES})
|
target_link_libraries(ConnectivityTool CryptoNoteCore Common Logging Crypto P2P Rpc Http Serialization System ${Boost_LIBRARIES})
|
||||||
target_link_libraries(Daemon CryptoNoteCore P2P Rpc Serialization System Http Logging Common Crypto upnpc-static BlockchainExplorer ${Boost_LIBRARIES})
|
target_link_libraries(Daemon CryptoNoteCore P2P Rpc Serialization System Http Logging Common Crypto upnpc-static BlockchainExplorer ${Boost_LIBRARIES})
|
||||||
target_link_libraries(SimpleWallet Wallet NodeRpcProxy Transfers Rpc Http Serialization CryptoNoteCore System Logging Common Crypto ${Boost_LIBRARIES})
|
target_link_libraries(SimpleWallet Wallet NodeRpcProxy Transfers Rpc Http Serialization CryptoNoteCore System Logging Common Crypto ${Boost_LIBRARIES})
|
||||||
target_link_libraries(PaymentGateService PaymentGate JsonRpcServer Wallet NodeRpcProxy Transfers CryptoNoteCore Crypto P2P Rpc Http Serialization System Logging Common InProcessNode upnpc-static BlockchainExplorer ${Boost_LIBRARIES})
|
target_link_libraries(PaymentGateService PaymentGate JsonRpcServer Wallet NodeRpcProxy Transfers CryptoNoteCore Crypto P2P Rpc Http Serialization System Logging Common InProcessNode upnpc-static BlockchainExplorer ${Boost_LIBRARIES})
|
||||||
|
target_link_libraries(Miner CryptoNoteCore Rpc Serialization System Http Logging Common Crypto ${Boost_LIBRARIES})
|
||||||
if (MSVC)
|
|
||||||
target_link_libraries(ConnectivityTool ws2_32)
|
|
||||||
target_link_libraries(SimpleWallet ws2_32)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_dependencies(Rpc version)
|
add_dependencies(Rpc version)
|
||||||
|
|
||||||
|
@ -77,5 +78,6 @@ add_dependencies(P2P version)
|
||||||
set_property(TARGET ConnectivityTool PROPERTY OUTPUT_NAME "connectivity_tool")
|
set_property(TARGET ConnectivityTool PROPERTY OUTPUT_NAME "connectivity_tool")
|
||||||
set_property(TARGET SimpleWallet PROPERTY OUTPUT_NAME "simplewallet")
|
set_property(TARGET SimpleWallet PROPERTY OUTPUT_NAME "simplewallet")
|
||||||
set_property(TARGET PaymentGateService PROPERTY OUTPUT_NAME "walletd")
|
set_property(TARGET PaymentGateService PROPERTY OUTPUT_NAME "walletd")
|
||||||
|
set_property(TARGET Miner PROPERTY OUTPUT_NAME "miner")
|
||||||
#TODO Specify the name of daemon for your currency
|
#TODO Specify the name of daemon for your currency
|
||||||
set_property(TARGET Daemon PROPERTY OUTPUT_NAME "cryptonoted")
|
set_property(TARGET Daemon PROPERTY OUTPUT_NAME "cryptonoted")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -107,6 +107,32 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename F, typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
|
||||||
|
void notify(F notification, const Arg0& arg0, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) {
|
||||||
|
std::vector<T*> observersCopy;
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(m_observersMutex);
|
||||||
|
observersCopy = m_observers;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (T* observer : observersCopy) {
|
||||||
|
(observer->*notification)(arg0, arg1, arg2, arg3, arg4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename F, typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
|
||||||
|
void notify(F notification, const Arg0& arg0, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) {
|
||||||
|
std::vector<T*> observersCopy;
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(m_observersMutex);
|
||||||
|
observersCopy = m_observers;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (T* observer : observersCopy) {
|
||||||
|
(observer->*notification)(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template<typename F, typename... Args>
|
template<typename F, typename... Args>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
24
src/Common/ScopeExit.cpp
Normal file
24
src/Common/ScopeExit.cpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include "ScopeExit.h"
|
||||||
|
|
||||||
|
namespace Tools {
|
||||||
|
|
||||||
|
ScopeExit::ScopeExit(std::function<void()>&& handler) :
|
||||||
|
m_handler(std::move(handler)),
|
||||||
|
m_cancelled(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopeExit::~ScopeExit() {
|
||||||
|
if (!m_cancelled) {
|
||||||
|
m_handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScopeExit::cancel() {
|
||||||
|
m_cancelled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
src/Common/ScopeExit.h
Normal file
28
src/Common/ScopeExit.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace Tools {
|
||||||
|
|
||||||
|
class ScopeExit {
|
||||||
|
public:
|
||||||
|
ScopeExit(std::function<void()>&& handler);
|
||||||
|
~ScopeExit();
|
||||||
|
|
||||||
|
ScopeExit(const ScopeExit&) = delete;
|
||||||
|
ScopeExit(ScopeExit&&) = delete;
|
||||||
|
ScopeExit& operator=(const ScopeExit&) = delete;
|
||||||
|
ScopeExit& operator=(ScopeExit&&) = delete;
|
||||||
|
|
||||||
|
void cancel();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<void()> m_handler;
|
||||||
|
bool m_cancelled;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void readVarint(IInputStream& in, uint64_t& value) {
|
||||||
throw std::runtime_error("readVarint, value overflow");
|
throw std::runtime_error("readVarint, value overflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
temp |= static_cast<size_t>(piece & 0x7f) << shift;
|
temp |= static_cast<uint64_t>(piece & 0x7f) << shift;
|
||||||
if ((piece & 0x80) == 0) {
|
if ((piece & 0x80) == 0) {
|
||||||
if (piece == 0 && shift != 0) {
|
if (piece == 0 && shift != 0) {
|
||||||
throw std::runtime_error("readVarint, invalid value representation");
|
throw std::runtime_error("readVarint, invalid value representation");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ public:
|
||||||
const static Size MAXIMUM_SIZE = MAXIMUM_SIZE_VALUE;
|
const static Size MAXIMUM_SIZE = MAXIMUM_SIZE_VALUE;
|
||||||
const static Size INVALID;
|
const static Size INVALID;
|
||||||
|
|
||||||
|
static_assert(MAXIMUM_SIZE != 0, "StringBuffer's size must not be zero");
|
||||||
|
|
||||||
// Default constructor.
|
// Default constructor.
|
||||||
// After construction, 'StringBuffer' is empty, that is 'size' == 0
|
// After construction, 'StringBuffer' is empty, that is 'size' == 0
|
||||||
StringBuffer() : size(0) {
|
StringBuffer() : size(0) {
|
||||||
|
@ -189,7 +191,6 @@ public:
|
||||||
|
|
||||||
// Compare two strings character-wise.
|
// Compare two strings character-wise.
|
||||||
bool operator<(StringView other) const {
|
bool operator<(StringView other) const {
|
||||||
assert(data != nullptr || size == 0);
|
|
||||||
Size count = other.getSize() < size ? other.getSize() : size;
|
Size count = other.getSize() < size ? other.getSize() : size;
|
||||||
for (Size i = 0; i < count; ++i) {
|
for (Size i = 0; i < count; ++i) {
|
||||||
Object char1 = *(data + i);
|
Object char1 = *(data + i);
|
||||||
|
@ -341,7 +342,6 @@ public:
|
||||||
// Looks for the last occurence of 'object' in 'StringView',
|
// Looks for the last occurence of 'object' in 'StringView',
|
||||||
// returns index or INVALID if there are no occurences.
|
// returns index or INVALID if there are no occurences.
|
||||||
Size findLast(const Object& object) const {
|
Size findLast(const Object& object) const {
|
||||||
assert(data != nullptr || size == 0);
|
|
||||||
for (Size i = 0; i < size; ++i) {
|
for (Size i = 0; i < size; ++i) {
|
||||||
if (*(data + (size - 1 - i)) == object) {
|
if (*(data + (size - 1 - i)) == object) {
|
||||||
return size - 1 - i;
|
return size - 1 - i;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -346,4 +346,9 @@ std::string get_nix_version_display_string()
|
||||||
return std::error_code(code, std::system_category());
|
return std::error_code(code, std::system_category());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool directoryExists(const std::string& path) {
|
||||||
|
boost::system::error_code ec;
|
||||||
|
return boost::filesystem::is_directory(path, ec);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -13,4 +13,5 @@ namespace Tools
|
||||||
std::string get_os_version_string();
|
std::string get_os_version_string();
|
||||||
bool create_directories_if_necessary(const std::string& path);
|
bool create_directories_if_necessary(const std::string& path);
|
||||||
std::error_code replace_file(const std::string& replacement_name, const std::string& replaced_name);
|
std::error_code replace_file(const std::string& replacement_name, const std::string& replaced_name);
|
||||||
|
bool directoryExists(const std::string& path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -306,7 +306,6 @@ m_currency(currency),
|
||||||
m_tx_pool(tx_pool),
|
m_tx_pool(tx_pool),
|
||||||
m_current_block_cumul_sz_limit(0),
|
m_current_block_cumul_sz_limit(0),
|
||||||
m_is_in_checkpoint_zone(false),
|
m_is_in_checkpoint_zone(false),
|
||||||
m_is_blockchain_storing(false),
|
|
||||||
m_checkpoints(logger) {
|
m_checkpoints(logger) {
|
||||||
|
|
||||||
m_outputs.set_deleted_key(0);
|
m_outputs.set_deleted_key(0);
|
||||||
|
@ -753,7 +752,7 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::
|
||||||
m_alternative_chains.erase(ch_ent);
|
m_alternative_chains.erase(ch_ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(BlockchainMessage(std::move(ChainSwitchMessage(std::move(blocksFromCommonRoot)))));
|
sendMessage(BlockchainMessage(ChainSwitchMessage(std::move(blocksFromCommonRoot))));
|
||||||
|
|
||||||
logger(INFO, BRIGHT_GREEN) << "REORGANIZE SUCCESS! on height: " << split_height << ", new blockchain size: " << m_blocks.size();
|
logger(INFO, BRIGHT_GREEN) << "REORGANIZE SUCCESS! on height: " << split_height << ", new blockchain size: " << m_blocks.size();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1066,7 +1065,7 @@ bool Blockchain::handle_alternative_block(const Block& b, const Crypto::Hash& id
|
||||||
<< ENDL << "PoW:\t" << proof_of_work
|
<< ENDL << "PoW:\t" << proof_of_work
|
||||||
<< ENDL << "difficulty:\t" << current_diff;
|
<< ENDL << "difficulty:\t" << current_diff;
|
||||||
if (sendNewAlternativeBlockMessage) {
|
if (sendNewAlternativeBlockMessage) {
|
||||||
sendMessage(BlockchainMessage(std::move(NewAlternativeBlockMessage(id))));
|
sendMessage(BlockchainMessage(NewAlternativeBlockMessage(id)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1617,7 +1616,7 @@ bool Blockchain::addNewBlock(const Block& bl_, block_verification_context& bvc)
|
||||||
} else {
|
} else {
|
||||||
add_result = pushBlock(bl, bvc);
|
add_result = pushBlock(bl, bvc);
|
||||||
if (add_result) {
|
if (add_result) {
|
||||||
sendMessage(BlockchainMessage(std::move(NewBlockMessage(id))));
|
sendMessage(BlockchainMessage(NewBlockMessage(id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ namespace CryptoNote {
|
||||||
bool get_out_by_msig_gindex(uint64_t amount, uint64_t gindex, MultisignatureOutput& out);
|
bool get_out_by_msig_gindex(uint64_t amount, uint64_t gindex, MultisignatureOutput& out);
|
||||||
bool checkTransactionInputs(const Transaction& tx, uint32_t& pmax_used_block_height, Crypto::Hash& max_used_block_id, BlockInfo* tail = 0);
|
bool checkTransactionInputs(const Transaction& tx, uint32_t& pmax_used_block_height, Crypto::Hash& max_used_block_id, BlockInfo* tail = 0);
|
||||||
uint64_t getCurrentCumulativeBlocksizeLimit();
|
uint64_t getCurrentCumulativeBlocksizeLimit();
|
||||||
bool isStoringBlockchain(){return m_is_blockchain_storing;}
|
|
||||||
uint64_t blockDifficulty(size_t i);
|
uint64_t blockDifficulty(size_t i);
|
||||||
bool getBlockContainingTransaction(const Crypto::Hash& txId, Crypto::Hash& blockId, uint32_t& blockHeight);
|
bool getBlockContainingTransaction(const Crypto::Hash& txId, Crypto::Hash& blockId, uint32_t& blockHeight);
|
||||||
bool getAlreadyGeneratedCoins(const Crypto::Hash& hash, uint64_t& generatedCoins);
|
bool getAlreadyGeneratedCoins(const Crypto::Hash& hash, uint64_t& generatedCoins);
|
||||||
|
@ -233,7 +232,6 @@ namespace CryptoNote {
|
||||||
std::string m_config_folder;
|
std::string m_config_folder;
|
||||||
Checkpoints m_checkpoints;
|
Checkpoints m_checkpoints;
|
||||||
std::atomic<bool> m_is_in_checkpoint_zone;
|
std::atomic<bool> m_is_in_checkpoint_zone;
|
||||||
std::atomic<bool> m_is_blockchain_storing;
|
|
||||||
|
|
||||||
typedef SwappedVector<BlockEntry> Blocks;
|
typedef SwappedVector<BlockEntry> Blocks;
|
||||||
typedef std::unordered_map<Crypto::Hash, uint32_t> BlockMap;
|
typedef std::unordered_map<Crypto::Hash, uint32_t> BlockMap;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -86,11 +86,6 @@ bool core::handle_command_line(const boost::program_options::variables_map& vm)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool core::is_ready() {
|
|
||||||
return !m_blockchain.isStoringBlockchain();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t core::get_current_blockchain_height() {
|
uint32_t core::get_current_blockchain_height() {
|
||||||
return m_blockchain.getCurrentBlockchainHeight();
|
return m_blockchain.getCurrentBlockchainHeight();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -35,18 +35,18 @@ namespace CryptoNote {
|
||||||
core(const Currency& currency, i_cryptonote_protocol* pprotocol, Logging::ILogger& logger);
|
core(const Currency& currency, i_cryptonote_protocol* pprotocol, Logging::ILogger& logger);
|
||||||
~core();
|
~core();
|
||||||
|
|
||||||
bool on_idle();
|
bool on_idle() override;
|
||||||
virtual bool handle_incoming_tx(const BinaryArray& tx_blob, tx_verification_context& tvc, bool keeped_by_block); //Deprecated. Should be removed with CryptoNoteProtocolHandler.
|
virtual bool handle_incoming_tx(const BinaryArray& tx_blob, tx_verification_context& tvc, bool keeped_by_block) override; //Deprecated. Should be removed with CryptoNoteProtocolHandler.
|
||||||
bool handle_incoming_block_blob(const BinaryArray& block_blob, block_verification_context& bvc, bool control_miner, bool relay_block);
|
bool handle_incoming_block_blob(const BinaryArray& block_blob, block_verification_context& bvc, bool control_miner, bool relay_block) override;
|
||||||
virtual i_cryptonote_protocol* get_protocol(){return m_pprotocol;}
|
virtual i_cryptonote_protocol* get_protocol() override {return m_pprotocol;}
|
||||||
const Currency& currency() const { return m_currency; }
|
const Currency& currency() const { return m_currency; }
|
||||||
|
|
||||||
//-------------------- IMinerHandler -----------------------
|
//-------------------- IMinerHandler -----------------------
|
||||||
virtual bool handle_block_found(Block& b);
|
virtual bool handle_block_found(Block& b) override;
|
||||||
virtual bool get_block_template(Block& b, const AccountPublicAddress& adr, difficulty_type& diffic, uint32_t& height, const BinaryArray& ex_nonce);
|
virtual bool get_block_template(Block& b, const AccountPublicAddress& adr, difficulty_type& diffic, uint32_t& height, const BinaryArray& ex_nonce) override;
|
||||||
|
|
||||||
bool addObserver(ICoreObserver* observer);
|
bool addObserver(ICoreObserver* observer) override;
|
||||||
bool removeObserver(ICoreObserver* observer);
|
bool removeObserver(ICoreObserver* observer) override;
|
||||||
|
|
||||||
miner& get_miner() { return *m_miner; }
|
miner& get_miner() { return *m_miner; }
|
||||||
static void init_options(boost::program_options::options_description& desc);
|
static void init_options(boost::program_options::options_description& desc);
|
||||||
|
@ -80,13 +80,12 @@ namespace CryptoNote {
|
||||||
virtual bool removeMessageQueue(MessageQueue<BlockchainMessage>& messageQueue) override;
|
virtual bool removeMessageQueue(MessageQueue<BlockchainMessage>& messageQueue) override;
|
||||||
|
|
||||||
uint32_t get_current_blockchain_height();
|
uint32_t get_current_blockchain_height();
|
||||||
bool have_block(const Crypto::Hash& id);
|
bool have_block(const Crypto::Hash& id) override;
|
||||||
std::vector<Crypto::Hash> buildSparseChain() override;
|
std::vector<Crypto::Hash> buildSparseChain() override;
|
||||||
std::vector<Crypto::Hash> buildSparseChain(const Crypto::Hash& startBlockId) override;
|
std::vector<Crypto::Hash> buildSparseChain(const Crypto::Hash& startBlockId) override;
|
||||||
void on_synchronized();
|
void on_synchronized() override;
|
||||||
bool is_ready() override;
|
|
||||||
|
|
||||||
virtual void get_blockchain_top(uint32_t& height, Crypto::Hash& top_id);
|
virtual void get_blockchain_top(uint32_t& height, Crypto::Hash& top_id) override;
|
||||||
bool get_blocks(uint32_t start_offset, uint32_t count, std::list<Block>& blocks, std::list<Transaction>& txs);
|
bool get_blocks(uint32_t start_offset, uint32_t count, std::list<Block>& blocks, std::list<Transaction>& txs);
|
||||||
bool get_blocks(uint32_t start_offset, uint32_t count, std::list<Block>& blocks);
|
bool get_blocks(uint32_t start_offset, uint32_t count, std::list<Block>& blocks);
|
||||||
template<class t_ids_container, class t_blocks_container, class t_missed_container>
|
template<class t_ids_container, class t_blocks_container, class t_missed_container>
|
||||||
|
@ -116,13 +115,13 @@ namespace CryptoNote {
|
||||||
//bool get_outs(uint64_t amount, std::list<Crypto::PublicKey>& pkeys);
|
//bool get_outs(uint64_t amount, std::list<Crypto::PublicKey>& pkeys);
|
||||||
virtual std::vector<Crypto::Hash> findBlockchainSupplement(const std::vector<Crypto::Hash>& remoteBlockIds, size_t maxCount,
|
virtual std::vector<Crypto::Hash> findBlockchainSupplement(const std::vector<Crypto::Hash>& remoteBlockIds, size_t maxCount,
|
||||||
uint32_t& totalBlockCount, uint32_t& startBlockIndex) override;
|
uint32_t& totalBlockCount, uint32_t& startBlockIndex) override;
|
||||||
bool get_stat_info(core_stat_info& st_inf);
|
bool get_stat_info(core_stat_info& st_inf) override;
|
||||||
|
|
||||||
virtual bool get_tx_outputs_gindexs(const Crypto::Hash& tx_id, std::vector<uint32_t>& indexs);
|
virtual bool get_tx_outputs_gindexs(const Crypto::Hash& tx_id, std::vector<uint32_t>& indexs) override;
|
||||||
Crypto::Hash get_tail_id();
|
Crypto::Hash get_tail_id();
|
||||||
virtual bool get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_response& res);
|
virtual bool get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_response& res) override;
|
||||||
void pause_mining();
|
void pause_mining() override;
|
||||||
void update_block_template_and_resume_mining();
|
void update_block_template_and_resume_mining() override;
|
||||||
//Blockchain& get_blockchain_storage(){return m_blockchain;}
|
//Blockchain& get_blockchain_storage(){return m_blockchain;}
|
||||||
//debug functions
|
//debug functions
|
||||||
void print_blockchain(uint32_t start_index, uint32_t end_index);
|
void print_blockchain(uint32_t start_index, uint32_t end_index);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2015 The Cryptonote developers
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ CoreConfig::CoreConfig() {
|
||||||
void CoreConfig::init(const boost::program_options::variables_map& options) {
|
void CoreConfig::init(const boost::program_options::variables_map& options) {
|
||||||
if (options.count(command_line::arg_data_dir.name) != 0 && (!options[command_line::arg_data_dir.name].defaulted() || configFolder == Tools::getDefaultDataDirectory())) {
|
if (options.count(command_line::arg_data_dir.name) != 0 && (!options[command_line::arg_data_dir.name].defaulted() || configFolder == Tools::getDefaultDataDirectory())) {
|
||||||
configFolder = command_line::get_arg(options, command_line::arg_data_dir);
|
configFolder = command_line::get_arg(options, command_line::arg_data_dir);
|
||||||
|
configFolderDefaulted = options[command_line::arg_data_dir.name].defaulted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue