Skip to content

Commit

Permalink
Fix "submit_response_from_server" not working
Browse files Browse the repository at this point in the history
  • Loading branch information
SwimmingTiger committed Apr 10, 2020
1 parent e3e9a7d commit 0ac0015
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bitcoin/ServerBitcoin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,16 @@ void UpStratumClientBitcoin::sendMiningAuthorize() {
if (submitResponseFromServer_) {
caps += ",\"" BTCAGENT_PROTOCOL_CAP_SUBRES "\"";
}
s = "{\"id\":\"" JSONRPC_GET_CAPS_REQ_ID "\",\"method\":\"agent.get_capabilities\",\"params\":[[" + caps + "]]}\n";
sendData(s);
string getCaps = "{\"id\":\"" JSONRPC_GET_CAPS_REQ_ID "\",\"method\":\"agent.get_capabilities\",\"params\":[[" + caps + "]]}\n";
sendData(getCaps);

// do mining.authorize
s = Strings::Format("{\"id\":1,\"method\":\"mining.authorize\",\"params\":[\"%s\",\"\"]}\n", userName_.c_str());
sendData(s);

// fix subres (submit_response_from_server)
// Subres negotiation must be sent after authentication, or sserver will not send the response.
sendData(getCaps);
}

void StratumSessionBitcoin::sendMiningNotify() {
Expand Down

0 comments on commit 0ac0015

Please sign in to comment.