Snipa22 / nodejs-pool

Other
479 stars 422 forks source link

Pool error with KRB coin: Error: Failed to parse block #270

Open DJREPTILE opened 6 years ago

DJREPTILE commented 6 years ago

On a fresh pool setup, i can this error in pool log once a miner will conntect to the pool:

2018-01-17 11:57 +01:00: Error: Failed to parse block at Coin.convertBlob (/home/pool/nodejs-pool/lib/coins/krb.js:87:23) at Coin.BlockTemplate.nextBlob (/home/pool/nodejs-pool/lib/coins/krb.js:140:37) at Miner.getJob (/home/pool/nodejs-pool/lib/pool.js:479:48) at handleMinerData (/home/pool/nodejs-pool/lib/pool.js:698:28) at handleMessage (/home/pool/nodejs-pool/lib/pool.js:898:13) at Socket. (/home/pool/nodejs-pool/lib/pool.js:956:25) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:246:13) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:594:20) 2018-01-17 11:57 +01:00: Error [ERR_IPC_CHANNEL_CLOSED]: channel closed at ChildProcess.target.send (internal/child_process.js:588:16) at Worker.send (internal/cluster/worker.js:54:28) at /home/pool/nodejs-pool/lib/pool.js:127:16 at Array.forEach () at sendToWorkers (/home/pool/nodejs-pool/lib/pool.js:126:16) at /home/pool/nodejs-pool/lib/pool.js:167:21 at /home/pool/nodejs-pool/lib/coins/krb.js:69:20 at /home/pool/nodejs-pool/lib/support.js:103:20 at Object.parseBody (/home/pool/nodejs-pool/node_modules/request-json/main.js:74:12) at Request._callback (/home/pool/nodejs-pool/node_modules/request-json/main.js:148:26) at Request.self.callback (/home/pool/nodejs-pool/node_modules/request-json/node_modules/request/request.js:187:22) at emitTwo (events.js:126:13) at Request.emit (events.js:214:7) at Request. (/home/pool/nodejs-pool/node_modules/request-json/node_modules/request/request.js:1044:10) at emitOne (events.js:116:13) at Request.emit (events.js:211:7)

CoinLogik commented 6 years ago

What coin?

DJREPTILE commented 6 years ago

KRB

CoinLogik commented 6 years ago

So the cryptonote-util module in nodejs-pool used cannot parse KRB coin header. You need to find a fork of cryptonote-util that can parse KRB.

bobbieltd commented 6 years ago

See #261

Rhys79 commented 6 years ago

Still working out a few bugs, but I have most of the kinks worked out for using NodeJS-Pool for Fork-Note based coins such as KRB/XLC/DCY/etc. There are a number of modifications that must be made in multiple files to get communications working properly with the FN style daemon and walletd. So far I have stats and mining working properly, but am still working out the kinks with mined blocks being marked orphaned when they are not, and won't be able to test payments until that's fixed. XLC in particular has been difficult as they have a block index starting at 1 rather than 0, the daemon crashes if you try to pull the header for the non-existent block 0, and the DB had all of the block IDs one digit higher than they should have been.

bobbieltd commented 6 years ago

I’m working on forknote too. If there are too many codes to change, I’ll abandon this kind of coins 😂

Rhys79 commented 6 years ago

The edits have been relatively minor so for, just difficult to track everything down that needs fixed.

Bathmat commented 6 years ago

I've also been trying to figure this out. I'm interested to hear if anyone gets it to work.

Oddly enough, I was able to get XLC working without too many problems. However, the other "forknote" coins seem to be more difficult.

@Rhys79 try changing these lines in blockManager.js to fix orphaned blocks: Lines 406/407 in current repo: global.support.rpcDaemon('getblockheaderbyheight', {"height": row.height + 1}, function (body) { if (body.result.block_header.hash === row.hash ? 0 : 1) {

bobbieltd commented 6 years ago

Minor changes 😂😂😂, now I feel PITA with forknote. You got to change a lot in payment coin javascript to make them compatible.

Rhys79 commented 6 years ago

Snipa has a krb.js (which is forknote) in the repo already, I just modified it to for XLC.

@Bathmat yep, we came to the same solution for the orphan block issue with XLC. Also had to switchout cnutils for fnutils in a couple of places and rebuild npm

Bathmat commented 6 years ago

I've tried doing KRB with Snipa's original code, and it was giving the same error as the start of this thread. Snipa did say he had KRB pool working, but that might have been a while ago.

@Rhys79, I've tried switching the utils, but the FN utils won't build in using any node v other than 0.10. Then the pool doesn't want to work with node less than v 4. I'm curious what you switched out...

Rhys79 commented 6 years ago

All I did was change a couple lines in the packages file, delete the node_modules folder, npm install, and changed cryptonote-utils to forknote-utils in a couple of .js files

bobbieltd commented 6 years ago

krb.js in Snipa’s repo 😂😂😂. Don’t make me laugh, it’s copy and paste from AEON/XMR. It won’t work with forknote. Attributes and methodes have different name. Very PITA. Even worker.js need move two parts to coin js.

bobbieltd commented 6 years ago

By the way, no need to worry for this mess. A pool owner will release his repo for forknote public soon and he is super at coding. My advice : waiting for him.

Rhys79 commented 6 years ago

Don't know what you're talking about, we just got XLC working with only a few minor edits, and I have KRB spun up with almost no edits, one small problem to track down (pool thread spamming the logs).

Use simplewallet in RPC mode and things pretty much just work once you get all the configuration done and swap cnutils out for fnutils (for KRB, XLC requires some modifications to blockManager.js to deal with the blockchain starting at 1 not 0). If you try to use walletd, yeah, LOTs of things that need changed, as the commands and responses are all different.

Bathmat commented 6 years ago

@Rhys79 which forknote utils are you using? I found two: https://github.com/avtc/node-cryptonote-util_forknote and https://github.com/wallet42/node-forknote-util

The ones from wallet42 didn't appear to work, but things seem to be working with avtc and a couple edits to pool.js to fix block refresh. However, xmr-node-proxy doesn't seem to want to work with the pool using those utils.

I currently have XLC, TRTL, and COAL pools running.

bobbieltd commented 6 years ago

I just want you guys not to lose time. If you don’t believe it, keep trying.

Rhys79 commented 6 years ago

Haven't tried xmr-node-proxy, as we are running xmrig-proxy and xmrigCC with some scripting.

Add "forknote-util": "git://github.com/wallet42/node-forknote-util.git" in package.json, then change const cnUtil = require('forknote-util'); in api.js and the krb.js or whatever coin you are using file in coins directory. Then delete node_modules folder and and do an npm install.

My associate did the little bit of work in the payments file to get that working correctly, but it was minimal, something about it expecting the txid returned in the payment RPC call, which FN simplewallet doesn't do. Was causing payments to think the payment didn't go through when it actually did. Other than that, it's just getting all the configuration correct.

Also, at least for xlc, as I mentioned, a couple of +1 or -1 to get it working with the 1 indexed blockchain. Hasn't been necessary for any others so far that I've found.

Bathmat commented 6 years ago

Gotcha. It seems to work either way, but yours allows for more flexibility I suppose. Thanks for your help.

Also, I tested xnp modded to use forknote cnutils and it seems to be working just fine.

bobbieltd commented 6 years ago

Sorry guys, sorry Snipa. My post “krb.js in Snipa’s repo 😂😂😂. Don’t make me laugh, it’s copy and paste from AEON/XMR. It won’t work with forknote. Attributes and methodes have different name. Very PITA. Even worker.js need move two parts to coin js.” is wrong. I’ve just known that now, I was idiot when I said that.

bobbieltd commented 6 years ago

@Bathmat Sorry, I have not noticed that you launched forknote pools in advance of me. I've made a false claim. I can't believe it. You're unbelievable with forknote nodejs-pool. For info, semiPOOL is mine.

Bathmat commented 6 years ago

@bobbieltd Honestly, I wouldn't have been able to do it without looking at your work. Thanks.

bobbieltd commented 6 years ago

@Bathmat : I admin that you’re better than me. I’ve just started forknote for some days ago and get stuck but you could modify the codes to make it work long time ago. Unbelievable. I’m not coders, I just go around seeing other devs’ code to add what I think is good to my codes (I still keep my forknote codes in private). For info, here is recently released ITNS (forknote) nodejs-pool for everyone from Venthos : https://github.com/Venthos/nodejs-pool . But the way he runs forknote is too complicated.

Bathmat commented 6 years ago

@bobbieltd I dunno about being better than you... I was just lucky enough to be able to put the pieces together. Good luck with your pools!