mining-pool / not-only-mining-pool

new generation general mining pool in go
MIT License
45 stars 34 forks source link

Marshaling Problem #1

Closed ashaw1131 closed 3 years ago

ashaw1131 commented 3 years ago

With the newest version of Bitcoind or BTCD

PANIC   daemonMgr   daemonManager/daemonManager.go:135  failed to unmarshal response body:[67 108 105 101 110 116 32 115 101 110 116 32 97 110 32 72 84 84 80 32 114 101 113 117 101 115 116 32 116 111 32 97 110 32 72 84 84 80 83 32 115 101 114 118 101 114 46 10]
panic: failed to unmarshal response body:[67 108 105 101 110 116 32 115 101 110 116 32 97 110 32 72 84 84 80 32 114 101 113 117 101 115 116 32 116 111 32 97 110 32 72 84 84 80 83 32 115 101 114 118 101 114 46 10]

I do believe that this needs to be updated in order to support Stratum v2

c0mm4nd commented 3 years ago

[67 108 105 101 110 116 32 115 101 110 116 32 97 110 32 72 84 84 80 32 114 101 113 117 101 115 116 32 116 111 32 97 110 32 72 84 84 80 83 32 115 101 114 118 101 114 46 10]=>Client sent an HTTP request to an HTTPS server.=>I will add tls support for wallet daemon conn

About stratum v2, as far as I know it's a new design for mining pool. But how does the support of mining rigs or software of scrypt x11 sha256d...? Without them the no-hashrate pool is valueless.

ashaw1131 commented 3 years ago

Stratum V2 does has its advantages, from what Ive read @ Stratum Protocol.

ashaw1131 commented 3 years ago
2020-10-15T14:49:12.040Z    PANIC   main    not-only-mining-pool/main.go:44unexpected EOF
panic: unexpected EOF
c0mm4nd commented 3 years ago
2020-10-15T14:49:12.040Z  PANIC   main    not-only-mining-pool/main.go:44unexpected EOF
panic: unexpected EOF

check your config.json

c0mm4nd commented 3 years ago

Stratum V2 does has its advantages, from what Ive read @ Stratum Protocol.

Mining pool is just one part of the whole mining industry, and cannot live without any other parts' cooperating. Currently only slushpool is pushing this going ahead, its too early for keeping steps with them. And I'm just a solo open-sourcing dev, not company, so I think it's worthless to develop a stratum v2 pool at this moment.

But if that most miner/mining rigs support this, I'm glad to join.

ashaw1131 commented 3 years ago

Server OS: Ubuntu 20.04 x64 Go Version: 1.13

config.json

"poolAddress": {
    "address": "2dffd149fe8682a94a5e105a377c6fc6e1bb1fc74498628f65ad89b0da88f2b7",
    "type": "script"
  },

I've even tried

"poolAddress": {
    "address": "bc1qlr36tpdwctfndcdgzx5ukjkqazl5hclkurw08q",
    "type": "script"
  },

New Error

go run main.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x247e88]
c0mm4nd commented 3 years ago

bc1qlr36tpdwctfndcdgzx5ukjkqazl5hclkurw08q should be a P2WSH or P2WPKH address (means segwit enabled).

check all supported "type" value here: https://github.com/mining-pool/not-only-mining-pool/blob/master/config/payment.go

ashaw1131 commented 3 years ago

@C0MM4ND First run was using the BTC Address hash, either way it fails with the above mentioned runtime error, I'm trying to figure out what is causing this.

c0mm4nd commented 3 years ago

image

image

image

I think the panic is not because of address

ashaw1131 commented 3 years ago

ok just to let you know I am currently testing this against BTCD https://github.com/btcsuite/btcd not bitcoind because I am trying to keep the footprint on my internal server minimal, bitcoind is way to sluggish. Still getting the same error, I will test it against bitcoind on a remote server in a bit

ashaw1131 commented 3 years ago

Tested with bitcoind

Remember I am on Ubuntu Linux, not Windows Tested Config with every option

go run main.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6aa43a]

goroutine 1 [running]:
net/http.(*Transport).roundTrip(0x0, 0xc0000d8c00, 0x30, 0xc0000f2060, 0x7f1d28592208)
    /usr/local/go/src/net/http/transport.go:493 +0x3a
net/http.(*Transport).RoundTrip(0x0, 0xc0000d8c00, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/roundtrip.go:17 +0x35
net/http.send(0xc0000d8c00, 0x914840, 0x0, 0x0, 0x0, 0x0, 0xc0000103c8, 0x203000, 0x1, 0x0)
    /usr/local/go/src/net/http/client.go:252 +0x453
net/http.(*Client).send(0xc0000f2030, 0xc0000d8c00, 0x0, 0x0, 0x0, 0xc0000103c8, 0x0, 0x1, 0xc0000f2000)
    /usr/local/go/src/net/http/client.go:176 +0xff
net/http.(*Client).do(0xc0000f2030, 0xc0000d8c00, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/client.go:718 +0x45f
net/http.(*Client).Do(...)
    /usr/local/go/src/net/http/client.go:586
github.com/mining-pool/not-only-mining-pool/daemonManager.(*DaemonManager).DoHttpRequest(0xc00000fb80, 0xc000032540, 0xc00002c400, 0x3d, 0x40, 0x0, 0x0, 0xc00002e600)
    /home/user/go/src/github.com/not-only-mining-pool/daemonManager/daemonManager.go:80 +0x1fb
github.com/mining-pool/not-only-mining-pool/daemonManager.(*DaemonManager).CmdAll(0xc00000fb80, 0x8a13b3, 0xb, 0xbb2db8, 0x0, 0x0, 0x20, 0xc00000fb80, 0x7f1d28591328, 0x82b9e0, ...)
    /home/user/go/src/github.com/not-only-mining-pool/daemonManager/daemonManager.go:124 +0x3cb
github.com/mining-pool/not-only-mining-pool/daemonManager.(*DaemonManager).IsAllOnline(0xc00000fb80, 0xc00000fb80)
    /home/user/go/src/github.com/not-only-mining-pool/daemonManager/daemonManager.go:41 +0x69
github.com/mining-pool/not-only-mining-pool/daemonManager.(*DaemonManager).Check(0xc00000fb80)
    /home/user/go/src/github.com/not-only-mining-pool/daemonManager/daemonManager.go:35 +0x2f
github.com/mining-pool/not-only-mining-pool/poolManager.NewPool(0xc0000ced80, 0x820540)
    /home/user/go/src/github.com/not-only-mining-pool/poolManager/pool.go:47 +0x7b
main.main()
    /home/user/go/src/github.com/not-only-mining-pool/main.go:47 +0x399
exit status 2
c0mm4nd commented 3 years ago

I cannot reproduce this panic.

btcd: ./btcd --testnet -u bitcoinrpc -P testnet

config.json

https://github.com/mining-pool/not-only-mining-pool/blob/master/config.btcd.json

ashaw1131 commented 3 years ago

Tested again with bitcoind with a fully synched node

go run main.go
{"id":779106405750227029,"method":"getpeerinfo","params":[]}
{"id":8843188983536579896,"method":"getblocktemplate","params":[{"capabilities":["coinbasetxn","workid","coinbase/append"],"rules":["segwit"]}]}
2020-10-17T13:26:22.874Z    INFO    jobMgr  New Job, diff: 1.9298087186262609936497640892589996547647692677874606379528596984945e+13
2020-10-17T13:26:22.874Z    INFO    jobMgr  New Job (Block) from block template
2020-10-17T13:26:22.874Z    WARN    api API server listening on 0.0.0.0:20000
panic: runtime error: index out of range [6] with length 6

Of course I ran this without TLS and Stratum is on the same server (for testing) and this is mainnet

c0mm4nd commented 3 years ago

Show me the location where the panic occurs please.

ashaw1131 commented 3 years ago
goroutine 1 [running]:
github.com/mining-pool/not-only-mining-pool/utils.GetReadableHashRateString(0x44214ff0ba5c7df8, 0x66, 0x7)
    /home/$user/go/src/not-only-mining-pool/utils/utils.go:412 +0x119
github.com/mining-pool/not-only-mining-pool/poolManager.(*Pool).OutputPoolInfo(0xc000164200)
    /home/$user/go/src/not-only-mining-pool/poolManager/pool.go:274 +0x296
github.com/mining-pool/not-only-mining-pool/poolManager.(*Pool).Init(0xc000164200)
    /home/$user/go/src/not-only-mining-pool/poolManager/pool.go:119 +0x181
main.main()
    /home/$user/go/src/not-only-mining-pool/main.go:48 +0x3a3
exit status 2
c0mm4nd commented 3 years ago

fixed on eccbca28a648a1a920516f42579e0864162cf1d6

ashaw1131 commented 3 years ago

great, closing this issue as fixed. Will be creating another for main and backup bitcoind servers.