Problems running btcpool's test program

< H2 > 1. Run the test program run_simulator < / H2 >

after compiling the btcpool source code, run its test program

cd /work/btcpool/build/run_simulator
./simulator -c simulator.cfg -l log_simulator

this program does not live in hang, so it is "finished" directly. I am not sure whether this program has gone wrong or what.
I would like to ask you, do you know how to run the btcpool test program (run_simulator) correctly? thank you!

< H2 > 2. View questions < / H2 >

I look at the log below log_simulator and find that the bottom line of the log is as follows:

E0403 14:34:04.956310   698 StratumClient.cc:256] event error: Connection refused

it is judged that sserver did not start. I used the command alone to start sserver, as follows:

root@zc-x0:/work/btcpool/build/run_sserver-sharp ./sserver -c sserver.cfg -l log_sserver/
F0403 14:35:37.795059   743 Kafka.cc:192] Failed to acquire metadata: Local: Timed out
*** Check failure stack trace: ***
    @     0x7ff03507c03d  google::LogMessage::Fail()
    @     0x7ff03507dea3  google::LogMessage::SendToLog()
    @     0x7ff03507bbcb  google::LogMessage::Flush()
    @     0x7ff03507e88e  google::LogMessageFatal::~LogMessageFatal()
    @           0x462e3b  KafkaConsumer::checkAlive()
    @           0x43ce48  JobRepository::setupThreadConsume()
    @           0x43efd9  Server::setup()
    @           0x43fb84  StratumServer::init()
    @           0x434973  main
    @     0x7ff0338d0830  __libc_start_main
    @           0x436af9  _start
Aborted (core dumped)
root@zc-x0:/work/btcpool/build/run_sserver-sharp 

View log

3 Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
  4 W0403 14:35:34.784273   743 StratumServerMain.cc:122] using bitcoin testnet3
  5 I0403 14:35:34.794375   743 Kafka.cc:347] producer librdkafka version: 0.9.1
  6 I0403 14:35:34.794396   743 Kafka.cc:347] producer librdkafka version: 0.9.1
  7 I0403 14:35:34.794406   743 Kafka.cc:347] producer librdkafka version: 0.9.1
  8 I0403 14:35:34.794416   743 Kafka.cc:347] producer librdkafka version: 0.9.1
  9 I0403 14:35:34.794425   743 Kafka.cc:347] producer librdkafka version: 0.9.1
 10 I0403 14:35:34.794432   743 Kafka.cc:82] consumer librdkafka version: 0.9.1
 11 I0403 14:35:34.794566   743 Kafka.cc:160] add brokers: 127.0.0.1:9092
 12 I0403 14:35:34.794602   743 Kafka.cc:167] create topic handle: StratumJob
 13 F0403 14:35:37.795059   743 Kafka.cc:192] Failed to acquire metadata: Local: Timed out

in view of the log judgment, it may be because there is no data in the Topic:StratumJob of kafka. (this is proved to be wrong later, and this step can be skipped.) so use the command to send a message for this topic with the producer, and then run sserver

again.
root@zc-x0:/work/btcpool/build/run_sserver-sharp ./sserver -c sserver.cfg  -l log_sserver/
F0403 16:10:05.019886  3165 StratumServerMain.cc:171] init failure
*** Check failure stack trace: ***
    @     0x7f27bad8703d  google::LogMessage::Fail()
    @     0x7f27bad88ea3  google::LogMessage::SendToLog()
    @     0x7f27bad86bcb  google::LogMessage::Flush()
    @     0x7f27bad8988e  google::LogMessageFatal::~LogMessageFatal()
    @           0x434ac5  main
    @     0x7f27b95db830  __libc_start_main
    @           0x436af9  _start
Aborted (core dumped)
root@zc-x0:/work/btcpool/build/run_sserver-sharp vi log_sserver/

View log vi log_sserver/sserver.INFO

3 Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
  4 W0403 17:24:39.469852  4886 StratumServerMain.cc:122] using bitcoin testnet3
  5 W0403 17:24:39.470086  4886 StratumServer.cc:862] Simulator is enabled, all share will be accepted
  6 I0403 17:24:39.470122  4886 Kafka.cc:347] producer librdkafka version: 0.9.1
  7 I0403 17:24:39.470132  4886 Kafka.cc:347] producer librdkafka version: 0.9.1
  8 I0403 17:24:39.470140  4886 Kafka.cc:347] producer librdkafka version: 0.9.1
  9 I0403 17:24:39.470146  4886 Kafka.cc:347] producer librdkafka version: 0.9.1
 10 I0403 17:24:39.470152  4886 Kafka.cc:347] producer librdkafka version: 0.9.1
 11 I0403 17:24:39.470158  4886 Kafka.cc:82] consumer librdkafka version: 0.9.1
 12 I0403 17:24:39.470310  4886 Kafka.cc:160] add brokers: 127.0.0.1:9092
 13 I0403 17:24:39.470350  4886 Kafka.cc:167] create topic handle: StratumJob
 14 I0403 17:24:39.577185  4891 StratumServer.cc:162] start job repository consume thread
 15 E0403 17:24:39.589262  4886 Utils.cc:221] unable to request data from: https://127.0.0.1/get_user_id_list?last_id=0, error: Couldn"t connect to server
 16 E0403 17:24:39.589727  4886 StratumServer.cc:480] http get request user list fail, url: https://127.0.0.1/get_user_id_list?last_id=0
 17 E0403 17:24:39.589777  4886 StratumServer.cc:547] update user list failure
 18 E0403 17:24:39.589867  4886 StratumServer.cc:776] fail to setup server
 19 F0403 17:24:39.589912  4886 StratumServerMain.cc:171] init failure
The configuration file for

sserver is as follows:

  1 -sharp
  2 -sharp stratum server cfg
  3 -sharp
  4 -sharp @since 2016-06
  5 -sharp @copyright btc.com
  6 -sharp
  7 
  8 -sharp is using testnet3
  9 testnet = true;
 10 
 11 kafka = {
 12   brokers = "127.0.0.1:9092"; -sharp "10.0.0.1:9092,10.0.0.2:9092,..."
 13 };
 14 
 15 sserver = {
 16   ip = "0.0.0.0";
 17   port = 3333;
 18 
 19   -sharp should be global unique, range: [1, 255]
 20   id = 1;
 21 
 22   -sharp write last mining notify job send time to file, for monitor
 23   file_last_notify_time = "/work/btcpool/build/run_sserver/sserver_lastnotifytime.txt";
 24 
 25   -sharp how many seconds between two share submit
 26   share_avg_seconds = 10;
 27 
 28   -sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp dev options -sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp
 29 
 30   -sharp if enable simulator, all share will be accepted. for testing
 31   enable_simulator = true;
 32 
 33   -sharp if enable it, all share will make block and submit. for testing
 34   enable_submit_invalid_block = false;
 35 
 36   -sharp if enable, difficulty sent to miners is always miner_difficulty. for development
 37   enable_dev_mode = false;
 38 
 39   -sharp difficulty to send to miners. for development
 40   miner_difficulty = 0.005;
 41 
 42   -sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp end of dev options -sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp
 43 };
 44 
 45 users = {
 46   -sharp
 47   -sharp https://example.com/get_user_id_list?last_id=0
 48   -sharp {"err_no":0,"err_msg":null,"data":{"jack":1,"terry":2}}
 49   -sharp
 50   -sharp There is a demo: https://github.com/btccom/btcpool/issues/16-sharpissuecomment-278245381
 51   -sharp
 52   list_id_api_url = "https://127.0.0.1/get_user_id_list";
 53 };
Mar.01,2021

as shown in the sserver log

 15 E0403 17:24:39.589262  4886 Utils.cc:221] unable to request data from: https://127.0.0.1/get_user_id_list?last_id=0, error: Couldn't connect to server
 16 E0403 17:24:39.589727  4886 StratumServer.cc:480] http get request user list fail, url: https://127.0.0.1/get_user_id_list?last_id=0
 17 E0403 17:24:39.589777  4886 StratumServer.cc:547] update user list failure
 18 E0403 17:24:39.589867  4886 StratumServer.cc:776] fail to setup server
 19 F0403 17:24:39.589912  4886 StratumServerMain.cc:171] init failure

refer to the comments on sserver.cfg . You need to build a web server (xx.yy), provide a website interface (/ get_user_id_list), and write the URL into the list_id_api_url item of the sserver.cfg file, as follows

.
users = {
    list_id_api_url = "http://xx.yy/get_user_id_list";
};
< hr >

you can build an apache or nginx server locally, and then follow the instructions on
https://github.com/btccom/btc.
.

Menu