Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gyp #468

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

Gyp #468

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fb5cd1a
Run clang-format
Feb 9, 2019
e7c5368
Merge pull request #240 from btccom/clang-format
de1acr0ix Feb 9, 2019
2db85bf
Add .inl files to clang-format script
Feb 11, 2019
786b1f6
Format all .inl files
Feb 11, 2019
bcb99f4
Simplified earning statistics
Feb 11, 2019
4fe00f0
Option to accept stale shares in slparser
Feb 11, 2019
69408d8
Option to accept stale shares in statshttpd
Feb 11, 2019
abba7b5
Merge pull request #241 from btccom/share-statistics
Feb 11, 2019
c983bf1
Dcrd 1.4.0 docker
Feb 13, 2019
57d86a4
Configurable SSL peer verifcation in blkmaker
Feb 13, 2019
105d824
Provide a default null stratum message dispatcher
Jan 15, 2019
318cd2f
Set CURLOPT_SSL_VERIFYHOST option (#242)
Feb 15, 2019
2d42d90
BTC: move mining.suggest_target handling
Feb 15, 2019
aabab91
Merge pull request #243 from btccom/suggest-target
Feb 15, 2019
fd057dc
jobmaker bitcoin: auxpow_gw_topic and rsk_rawgw_topic will don't trig…
SwimmingTiger Feb 21, 2019
1339f97
update the height of ETH Constantinople hardfork to 7280000.
Feb 26, 2019
66c65ee
BTC: use short job ID from 0 to 255
Feb 20, 2019
34f4128
Fix unittest errors
Feb 27, 2019
8221901
Fix clang-format
Feb 27, 2019
805b5e9
Fix TestStatistics.cc
Feb 27, 2019
c3f45b6
Use static network configuration in DCR
Dec 14, 2018
8de9cbb
Change DCR protocol option gominer to nicehash
Dec 14, 2018
85ae853
Merge pull request #248 from btccom/dcr-option-change
Feb 27, 2019
9fbf894
Reverse seek local jobs
Feb 28, 2019
82389e4
Dispatch sserver tasks in libevent loop
Mar 1, 2019
dab18b2
sserver: Fix a potential memory exception
SwimmingTiger Mar 1, 2019
99895c2
sserver bitcoin: fix "job not found" for NiceHash client
Mar 10, 2019
ee1ddc1
sserver: ignore SIGPIPE, avoiding process be killed
Mar 17, 2019
d16a45f
gwmaker RSK: fix "rsk getwork fields failure" in jobmaker
Mar 27, 2019
bc24673
更改收益
gstchain Sep 27, 2020
1284f78
更改收益模式
gstchain Oct 14, 2020
90a901c
取消前缀
gstchain Oct 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ add_library(
${LIB_SOURCES_SHARES}
${LIB_SOURCES_CHAINS})

file(GLOB_RECURSE TEST_SOURCES test/*.cpp)
file(GLOB_RECURSE TEST_SOURCES test/*.cc)
add_executable(unittest ${TEST_SOURCES} 3rdparty/gmock-gtest-all.cc)
target_link_libraries(unittest btcpool ${THIRD_LIBRARIES})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ RUN apt-get update && apt-get install -y net-tools wget

# download dcrd
RUN mkdir ~/source
RUN cd ~/source && wget https://github.com/decred/decred-binaries/releases/download/v1.4.0-rc1/decred-linux-amd64-v1.4.0-rc1.tar.gz
RUN cd ~/source && [ $(sha256sum decred-linux-amd64-v1.4.0-rc1.tar.gz | cut -d " " -f 1) = "db26781c877a40762bbcaf7eb17c9c8a2da803682612e63b5f798131d766d635" ] && \
tar zxvf decred-linux-amd64-v1.4.0-rc1.tar.gz && \
cp decred-linux-amd64-v1.4.0-rc1/dcr* /usr/local/bin
RUN cd ~/source && wget https://github.com/decred/decred-binaries/releases/download/v1.4.0/decred-linux-amd64-v1.4.0.tar.gz
RUN cd ~/source && [ $(sha256sum decred-linux-amd64-v1.4.0.tar.gz | cut -d " " -f 1) = "36375985df1ba9a45bc11b4f6cdaed4f14ff6e5e9c46e17ef6e4f70a3349aba2" ] && \
tar zxvf decred-linux-amd64-v1.4.0.tar.gz && \
cp decred-linux-amd64-v1.4.0/dcr* /usr/local/bin

# mkdir dcrd data dir
RUN mkdir -p /root/.dcrd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Docker for Dcrd v1.4.0-rc1
Docker for Dcrd v1.4.0
============================

* OS: `Ubuntu 14.04 LTS`
* Docker Image OS: `Ubuntu 16.04 LTS`
* Dcrd: `v1.4.0-rc1`
* Dcrd: `v1.4.0`

## Install Docker

Expand All @@ -22,13 +22,13 @@ service docker status
cd /work

git clone https://github.com/btccom/btcpool.git
cd btcpool/docker/dcrd/v1.4.0-rc1
cd btcpool/docker/dcrd/v1.4.0

# If your server is in China, please check "Dockerfile" and uncomment some lines.

# build
docker build -t dcrd:1.4.0-rc1 .
# docker build --no-cache -t dcrd:1.4.0-rc1 .
docker build -t dcrd:1.4.0 .
# docker build --no-cache -t dcrd:1.4.0 .

# mkdir for dcrd
mkdir -p /work/dcrd
Expand Down Expand Up @@ -62,7 +62,7 @@ listen=address:port

```
# start docker (mainnet, assuming listening port 9108 & RPC listening port 9109)
docker run -it -v /work/dcrd:/root/.dcrd --name dcrd -p 9108:9108 -p 9109:9109 --restart always -d dcrd:1.4.0-rc1
docker run -it -v /work/dcrd:/root/.dcrd --name dcrd -p 9108:9108 -p 9109:9109 --restart always -d dcrd:1.4.0

# login
docker exec -it dcrd /bin/bash
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion run-clang-format.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
for SRC_DIR in src test tools
do
find $SRC_DIR -name '*.h' -or -name '*.cc' | xargs clang-format -i -style file
find $SRC_DIR -name '*.h' -or -name '*.inl' -or -name '*.cc' | xargs clang-format -i -style file
done

21 changes: 13 additions & 8 deletions src/BlockMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
#include "BlockMaker.h"

////////////////////////////////// BlockMaker //////////////////////////////////
BlockMaker::BlockMaker(shared_ptr<BlockMakerDefinition> def, const char *kafkaBrokers, const MysqlConnectInfo &poolDB)
BlockMaker::BlockMaker(
shared_ptr<BlockMakerDefinition> def,
const char *kafkaBrokers,
const MysqlConnectInfo &poolDB)
: def_(def)
, running_(true)
, kafkaConsumerSolvedShare_(kafkaBrokers, def_->solvedShareTopic_.c_str(), 0/* patition */)
, poolDB_(poolDB)
{
, kafkaConsumerSolvedShare_(
kafkaBrokers, def_->solvedShareTopic_.c_str(), 0 /* patition */)
, poolDB_(poolDB) {
}

BlockMaker::~BlockMaker() {
Expand Down Expand Up @@ -67,16 +70,18 @@ void BlockMaker::consumeSolvedShare(rd_kafka_message_t *rkmessage) {
if (rkmessage->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
// Reached the end of the topic+partition queue on the broker.
// Not really an error.
// LOG(INFO) << "consumer reached end of " << rd_kafka_topic_name(rkmessage->rkt)
// LOG(INFO) << "consumer reached end of " <<
// rd_kafka_topic_name(rkmessage->rkt)
// << "[" << rkmessage->partition << "] "
// << " message queue at offset " << rkmessage->offset;
// acturlly
return;
}

LOG(ERROR) << "consume error for topic " << rd_kafka_topic_name(rkmessage->rkt)
<< "[" << rkmessage->partition << "] offset " << rkmessage->offset
<< ": " << rd_kafka_message_errstr(rkmessage);
LOG(ERROR) << "consume error for topic "
<< rd_kafka_topic_name(rkmessage->rkt) << "["
<< rkmessage->partition << "] offset " << rkmessage->offset
<< ": " << rd_kafka_message_errstr(rkmessage);

if (rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION ||
rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC) {
Expand Down
22 changes: 10 additions & 12 deletions src/BlockMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,22 @@

#include <vector>

struct NodeDefinition
{
struct NodeDefinition {
string rpcAddr_;
string rpcUserPwd_;
};

struct BlockMakerDefinition
{
struct BlockMakerDefinition {
string chainType_;
bool enabled_;
vector<NodeDefinition> nodes;
vector<NodeDefinition> nodes;
string solvedShareTopic_;
string foundAuxBlockTable_;

virtual ~BlockMakerDefinition() {}
};

struct BlockMakerDefinitionBitcoin : public BlockMakerDefinition
{
struct BlockMakerDefinitionBitcoin : public BlockMakerDefinition {
string rawGbtTopic_;
string stratumJobTopic_;
string auxPowSolvedShareTopic_; // merged mining solved share topic
Expand All @@ -59,8 +56,7 @@ struct BlockMakerDefinitionBitcoin : public BlockMakerDefinition
};

////////////////////////////////// BlockMaker //////////////////////////////////
class BlockMaker
{
class BlockMaker {
protected:
shared_ptr<BlockMakerDefinition> def_;
atomic<bool> running_;
Expand All @@ -74,9 +70,12 @@ class BlockMaker
virtual void processSolvedShare(rd_kafka_message_t *rkmessage) = 0;

public:
BlockMaker(shared_ptr<BlockMakerDefinition> def, const char *kafkaBrokers, const MysqlConnectInfo &poolDB);
BlockMaker(
shared_ptr<BlockMakerDefinition> def,
const char *kafkaBrokers,
const MysqlConnectInfo &poolDB);
virtual ~BlockMaker();

// read-only definition
inline shared_ptr<const BlockMakerDefinition> def() { return def_; }

Expand All @@ -85,5 +84,4 @@ class BlockMaker
virtual void run();
};


#endif
6 changes: 2 additions & 4 deletions src/Common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
*/
#include "Common.h"

uint32_t djb2(const char *s)
{
uint32_t djb2(const char *s) {
uint32_t hash = 5381;
int c;
uint8_t* str = (uint8_t*) s;
uint8_t *str = (uint8_t *)s;
while ((c = *str++))
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */

Expand All @@ -51,4 +50,3 @@ uint64_t formatDifficulty(const uint64_t diff) {
assert(i <= 63);
return 1ULL << i;
}

20 changes: 7 additions & 13 deletions src/Common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
The MIT License (MIT)

Copyright (c) [2016] [BTC.COM]
Expand Down Expand Up @@ -69,7 +69,6 @@ typedef lock_guard<mutex> ScopeLock;
typedef unique_lock<mutex> UniqueLock;
typedef condition_variable Condition;


/**
* byte order conversion utils
*/
Expand All @@ -78,20 +77,15 @@ inline uint16_t HToBe(uint16_t v) {
return (v >> 8) | (v << 8);
}
inline uint32_t HToBe(uint32_t v) {
return ((v & 0xff000000) >> 24) |
((v & 0x00ff0000) >> 8) |
((v & 0x0000ff00) << 8) |
((v & 0x000000ff) << 24);
return ((v & 0xff000000) >> 24) | ((v & 0x00ff0000) >> 8) |
((v & 0x0000ff00) << 8) | ((v & 0x000000ff) << 24);
}
inline uint64_t HToBe(uint64_t v) {
return ((v & 0xff00000000000000ULL) >> 56) |
((v & 0x00ff000000000000ULL) >> 40) |
((v & 0x0000ff0000000000ULL) >> 24) |
((v & 0x000000ff00000000ULL) >> 8) |
((v & 0x00000000ff000000ULL) << 8) |
((v & 0x0000000000ff0000ULL) << 24) |
((v & 0x000000000000ff00ULL) << 40) |
((v & 0x00000000000000ffULL) << 56);
((v & 0x00ff000000000000ULL) >> 40) |
((v & 0x0000ff0000000000ULL) >> 24) | ((v & 0x000000ff00000000ULL) >> 8) |
((v & 0x00000000ff000000ULL) << 8) | ((v & 0x0000000000ff0000ULL) << 24) |
((v & 0x000000000000ff00ULL) << 40) | ((v & 0x00000000000000ffULL) << 56);
}
#else
inline uint16_t HToBe(uint16_t v) {
Expand Down
15 changes: 9 additions & 6 deletions src/CreateStratumServerTemp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
#include "sia/StratumServerSia.h"
#include "decred/StratumServerDecred.h"

Server* createStratumServer(const std::string &type, const int32_t shareAvgSeconds, const libconfig::Config& config) {
LOG(INFO) << "createServer type: " << type << ", shareAvgSeconds: " << shareAvgSeconds;
Server *createStratumServer(
const std::string &type,
const int32_t shareAvgSeconds,
const libconfig::Config &config) {
LOG(INFO) << "createServer type: " << type
<< ", shareAvgSeconds: " << shareAvgSeconds;
#if defined(CHAIN_TYPE_STR)
if (CHAIN_TYPE_STR == type)
#else
#else
if (false)
#endif
return new ServerBitcoin(shareAvgSeconds, config);
else if ("ETH" == type)
return new ServerEth(shareAvgSeconds);
else if ("SIA" == type)
return new ServerSia(shareAvgSeconds);
else if ("BTM" == type)
return new ServerBytom (shareAvgSeconds);
else if ("BTM" == type)
return new ServerBytom(shareAvgSeconds);
else if ("DCR" == type)
return new ServerDecred(shareAvgSeconds, config);
return nullptr;
}

5 changes: 4 additions & 1 deletion src/CreateStratumServerTemp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class Config;

class Server;

Server* createStratumServer(const std::string &type, const int32_t shareAvgSeconds, const libconfig::Config &config);
Server *createStratumServer(
const std::string &type,
const int32_t shareAvgSeconds,
const libconfig::Config &config);

#endif
Loading