diff --git a/internal/gui/assets/templates/index.html b/internal/gui/assets/templates/index.html index 7f94d9c0..3e0a88bb 100644 --- a/internal/gui/assets/templates/index.html +++ b/internal/gui/assets/templates/index.html @@ -68,10 +68,6 @@

Identify the Miner

rel="noopener noreferrer" href="http://www.innosilicon.com.cn/download/d9_20190521_071217.swu">Innosilicon D9 -
  • Antminer DR3 -
  • Obelisk DCR1 diff --git a/pool/client.go b/pool/client.go index a8ecbaf5..d401833c 100644 --- a/pool/client.go +++ b/pool/client.go @@ -420,18 +420,6 @@ func (c *Client) handleSubscribeRequest(req *Request, allowed bool) error { resp = SubscribeResponse(*req.ID, nid, c.extraNonce1, ExtraNonce2Size, nil) - case AntminerDR3: - // The DR3 is not fully complaint with the stratum spec. - // It uses an 8-byte extraNonce2 regardless of the - // extraNonce2Size provided. - // - // The extraNonce1 is appended to the extraNonce2 in the - // extraNonce2 value returned in mining.submit. As a result, - // the extraNonce1 sent in mining.subscribe response is formatted as: - // extraNonce2 space (8-byte) + miner's extraNonce1 (4-byte) - paddedExtraNonce1 := strings.Repeat("0", 16) + c.extraNonce1 - resp = SubscribeResponse(*req.ID, nid, paddedExtraNonce1, 8, nil) - default: // The default case handles mining clients that support the // stratum spec and respect the extraNonce2Size provided. @@ -921,42 +909,6 @@ func hexReversed(in string) (string, error) { return buf.String(), nil } -// handleAntminerDR3 prepares work notifications for the Antminer DR3. -func (c *Client) handleAntminerDR3Work(req *Request) { - miner := "AntminerDR3" - jobID, prevBlock, genTx1, genTx2, blockVersion, nBits, nTime, - cleanJob, err := ParseWorkNotification(req) - if err != nil { - log.Errorf("%s: %v", miner, err) - } - - // The DR3 requires the nBits and nTime fields of a mining.notify message - // as big endian. - nBits, err = hexReversed(nBits) - if err != nil { - log.Errorf("%s: %v for nBits", miner, err) - c.cancel() - return - } - nTime, err = hexReversed(nTime) - if err != nil { - log.Errorf("%s: %v for nTime", miner, err) - c.cancel() - return - } - prevBlockRev := reversePrevBlockWords(prevBlock) - workNotif := WorkNotification(jobID, prevBlockRev, - genTx1, genTx2, blockVersion, nBits, nTime, cleanJob) - err = c.encoder.Encode(workNotif) - if err != nil { - log.Errorf("%s: work encoding error, %v", miner, err) - c.cancel() - return - } - - atomic.StoreInt64(&c.lastWorkTime, time.Now().Unix()) -} - // handleInnosiliconD9Work prepares work notifications for the Innosilicon D9. func (c *Client) handleInnosiliconD9Work(req *Request) { miner := "InnosiliconD9" @@ -1209,10 +1161,6 @@ func (c *Client) send() { c.handleCPUWork(req) log.Tracef("%s notified of new work", id) - case AntminerDR3: - c.handleAntminerDR3Work(req) - log.Tracef("%s notified of new work", id) - case InnosiliconD9: c.handleInnosiliconD9Work(req) log.Tracef("%s notified of new work", id) diff --git a/pool/client_test.go b/pool/client_test.go index fd643677..ee711c5b 100644 --- a/pool/client_test.go +++ b/pool/client_test.go @@ -375,43 +375,6 @@ func testClientMessageHandling(t *testing.T) { t.Fatalf("expected %s message method, got %s", SetDifficulty, req.Method) } - // Ensure an Antminer DR3 client receives a valid non-error - // response when a valid subscribe request is sent. - err = setMiner(client, AntminerDR3) - if err != nil { - t.Fatalf("unexpected set miner error: %v", err) - } - - id++ - dr3, dr3Version := splitMinerID(dr3ID) - r = SubscribeRequest(&id, userAgent(dr3, dr3Version), "") - err = sE.Encode(r) - if err != nil { - t.Fatalf("[Encode] unexpected error: %v", err) - } - select { - case <-client.ctx.Done(): - t.Fatalf("client context done: %v", err) - case data = <-recvCh: - } - msg, mType, err = IdentifyMessage(data) - if err != nil { - t.Fatalf("[IdentifyMessage] unexpected error: %v", err) - } - if mType != ResponseMessage { - t.Fatalf("expected a subscribe response message, got %v", mType) - } - resp, ok = msg.(*Response) - if !ok { - t.Fatalf("expected response with id %d, got %d", *r.ID, resp.ID) - } - if resp.ID != *r.ID { - t.Fatalf("expected response with id %d, got %d", *r.ID, resp.ID) - } - if resp.Error != nil { - t.Fatalf("expected a non-error response, got %s", resp.Error.Message) - } - // Ensure an Obelisk DCR1 client receives a valid non-error // response when a valid subscribe request is sent. err = setMiner(client, ObeliskDCR1) @@ -647,36 +610,6 @@ func testClientMessageHandling(t *testing.T) { t.Fatalf("[claimWeightedShare (D9)] unexpected error: %v", err) } - // Send a work notification to an Antminer DR3 client. - err = setMiner(client, AntminerDR3) - if err != nil { - t.Fatalf("unexpected set miner error: %v", err) - } - - select { - case <-client.ctx.Done(): - t.Fatalf("client context done: %v", err) - case client.ch <- r: - } - - // Ensure the work notification received is unique to the DR3. - var dr3Work []byte - select { - case <-client.ctx.Done(): - t.Fatalf("client context done: %v", err) - case dr3Work = <-recvCh: - } - if !bytes.Equal(dr3Work, d9Work) { - t.Fatalf("expected antminer dr3 work to be equal to innosilicon d9 " + - "work") - } - - // Claim a weighted share for the Antminer DR3. - err = client.claimWeightedShare() - if err != nil { - t.Fatalf("[claimWeightedShare (DR3)] unexpected error: %v", err) - } - // Send a work notification to an Obelisk DCR1 client. err = setMiner(client, ObeliskDCR1) if err != nil { @@ -696,9 +629,8 @@ func testClientMessageHandling(t *testing.T) { t.Fatalf("client context done: %v", err) case dcr1Work = <-recvCh: } - if !bytes.Equal(dr3Work, dcr1Work) { - t.Fatalf("expected obelisk DCR1 work to be different from " + - "antminer dr3 work") + if bytes.Equal(cpuWork, dcr1Work) { + t.Fatalf("expected obelisk DCR1 work to be different from cpu work") } // Claim a weighted share for the Obelisk DCR1. @@ -1006,40 +938,6 @@ func testClientMessageHandling(t *testing.T) { t.Fatalf("expected no-error work submission response, got %v", resp.Error) } - // Ensure the pool processes Antminer DR3 work submissions. - err = setMiner(client, AntminerDR3) - if err != nil { - t.Fatalf("unexpected set miner error: %v", err) - } - - id++ - sub = SubmitWorkRequest(&id, "tcl", job.UUID, "00000000", - "954cee5d", "6ddf0200") - err = sE.Encode(sub) - if err != nil { - t.Fatalf("[Encode] unexpected error: %v", err) - } - var dr3Sub []byte - select { - case <-client.ctx.Done(): - t.Fatalf("client context done: %v", err) - case dr3Sub = <-recvCh: - } - msg, mType, err = IdentifyMessage(dr3Sub) - if err != nil { - t.Fatalf("[IdentifyMessage] unexpected error: %v", err) - } - if mType != ResponseMessage { - t.Fatalf("expected a response message, got %v", mType) - } - resp, ok = msg.(*Response) - if !ok { - t.Fatalf("unable to cast message as response") - } - if resp.ID != *sub.ID { - t.Fatalf("expected a response with id %d, got %d", *sub.ID, resp.ID) - } - // Ensure the pool processes Innosilicon D9 work submissions. err = setMiner(client, InnosiliconD9) if err != nil { diff --git a/pool/difficulty.go b/pool/difficulty.go index 60a7f80b..801b1410 100644 --- a/pool/difficulty.go +++ b/pool/difficulty.go @@ -20,7 +20,6 @@ import ( const ( CPU = "cpu" InnosiliconD9 = "innosilicond9" - AntminerDR3 = "antminerdr3" ObeliskDCR1 = "obeliskdcr1" NiceHashValidator = "nicehash" ) @@ -32,7 +31,6 @@ var ( CPU: new(big.Int).SetInt64(5e3), ObeliskDCR1: new(big.Int).SetInt64(1.2e12), InnosiliconD9: new(big.Int).SetInt64(2.4e12), - AntminerDR3: new(big.Int).SetInt64(7.8e12), NiceHashValidator: new(big.Int).SetInt64(20e10), } ) diff --git a/pool/difficulty_test.go b/pool/difficulty_test.go index bc3072ad..f0a52626 100644 --- a/pool/difficulty_test.go +++ b/pool/difficulty_test.go @@ -73,20 +73,16 @@ func TestDifficulty(t *testing.T) { diffSet := []struct { miner string expectedErr error - }{ - { - miner: CPU, - expectedErr: nil, - }, - { - miner: "", - expectedErr: errs.ValueNotFound, - }, - { - miner: "antminerdr7", - expectedErr: errs.ValueNotFound, - }, - } + }{{ + miner: CPU, + expectedErr: nil, + }, { + miner: "", + expectedErr: errs.ValueNotFound, + }, { + miner: "non-existent", + expectedErr: errs.ValueNotFound, + }} for idx, tc := range diffSet { net := chaincfg.SimNetParams() diff --git a/pool/message.go b/pool/message.go index f21d6e7c..cac1a9f3 100644 --- a/pool/message.go +++ b/pool/message.go @@ -626,24 +626,6 @@ func GenerateSolvedBlockHeader(headerE string, extraNonce1E string, copy(headerEB[288:296], []byte(extraNonce1E)) copy(headerEB[296:304], []byte(extraNonce2E)) - // The Antiminer DR3 returns a 12-byte extraNonce comprised of the - // extraNonce1 and extraNonce2 regardless of the extraNonce2Size specified - // in the mining.subscribe message. The nTime and nonce values submitted are - // big endian, they have to be reversed before block header reconstruction. - case AntminerDR3: - nTimeERev, err := hexReversed(nTimeE) - if err != nil { - return nil, err - } - copy(headerEB[272:280], []byte(nTimeERev)) - - nonceERev, err := hexReversed(nonceE) - if err != nil { - return nil, err - } - copy(headerEB[280:288], []byte(nonceERev)) - copy(headerEB[288:312], []byte(extraNonce2E)) - // The Innosilicon D9 respects the extraNonce2Size specified in the // mining.subscribe response sent to it. The extraNonce2 value submitted is // exclusively the extraNonce2. The nTime and nonce values submitted are diff --git a/pool/miner_id.go b/pool/miner_id.go index 7809cc4b..8bb19096 100644 --- a/pool/miner_id.go +++ b/pool/miner_id.go @@ -17,7 +17,6 @@ var ( cpuID = "cpuminer/1.0.0" dcr1ID = "cgminer/4.10.0" d9ID = "sgminer/4.4.2" - dr3ID = "cgminer/4.9.0" nhID = "NiceHash/1.0.0" ) @@ -47,13 +46,11 @@ func generateMinerIDs() map[string]*minerIDPair { cpu := newMinerIDPair(cpuID, CPU) obelisk := newMinerIDPair(dcr1ID, ObeliskDCR1) innosilicon := newMinerIDPair(d9ID, InnosiliconD9) - antminer := newMinerIDPair(dr3ID, AntminerDR3) nicehash := newMinerIDPair(nhID, NiceHashValidator) ids[cpu.id] = cpu ids[obelisk.id] = obelisk ids[innosilicon.id] = innosilicon - ids[antminer.id] = antminer ids[nicehash.id] = nicehash return ids } diff --git a/pool/share.go b/pool/share.go index 4980f855..c6f1ddc9 100644 --- a/pool/share.go +++ b/pool/share.go @@ -21,7 +21,6 @@ var ShareWeights = map[string]*big.Rat{ CPU: new(big.Rat).SetFloat64(1.0), // Reserved for testing. ObeliskDCR1: new(big.Rat).SetFloat64(1.0), InnosiliconD9: new(big.Rat).SetFloat64(2.182), - AntminerDR3: new(big.Rat).SetFloat64(7.091), } // shareID generates a unique share id using the provided account, creation