nodejs-pool icon indicating copy to clipboard operation
nodejs-pool copied to clipboard

Upgrade after fork

Open snoski3 opened this issue 7 years ago • 31 comments

What will we need to do to upgrade our pool software after the fork?

Thanks

snoski3 avatar Apr 05 '18 11:04 snoski3

you can get more info here:

https://github.com/Snipa22/nodejs-pool/issues/362

shigutso avatar Apr 05 '18 12:04 shigutso

The below works for me:

Part I: cd /usr/local/src/monero sudo git checkout . sudo git checkout master sudo git pull sudo git checkout origin/release-v0.12

replace line no. 1096 of src/cryptonote_core/tx_pool.cpp with: while (sorted_it != m_txs_by_fee_and_receive_time.end() && bl.tx_hashes.size() <= 120) sudo apt purge libgtest-dev (if it's installed) sudo rm -rf build make CXXFLAGS=-fPIC CFLAGS=-fPIC

Add --db-salvage --data-dir /home/monerodaemon/.bitmonero to the ExecStart of /lib/systemd/system/monero.service sudo systemctl daemon-reload sudo service monero restart

Part II: In SQL: update pool.config set item_value=18083 where id=16; (change monero-wallet-rpc port) cd ~/nodejs-pool pm2 delete monero-wallet-rpc pm2 start /usr/local/src/monero/build/release/bin/monero-wallet-rpc -- --rpc-bind-port 18083 --password-file ~/wallet_pass --wallet-file <Your wallet name here> --disable-rpc-login --trusted-daemon

Repeat Part I on any leafs you might have.

That's it. Let us know how it goes.

78bash avatar Apr 05 '18 13:04 78bash

@78bash You need to update nodejs-pool with utils. No need to change wallet port.

bobbieltd avatar Apr 05 '18 13:04 bobbieltd

Thanks for the tip @bobbieltd , can I get an example of specific commands/instructions? #379 for reference.

78bash avatar Apr 05 '18 13:04 78bash

There are two options at the moment. You can use MoneroOcean or Venthos utils. MoneroOcean repo drips further away from Snipa (multiple coins). Venthos is more active on one coin. Packages.json —> "cryptonight-hashing": "git://github.com/Venthos/node-cryptonight-hashing.git" Change cryptonight in xmr.js coin —> this.cryptoNight = function(convertedBlob) { let cn_variant = convertedBlob[0] >= 7 ? convertedBlob[0] - 6 : 0; return cnHashing.cryptonight(convertedBlob, cn_variant); };

I think it’s enough.

bobbieltd avatar Apr 05 '18 14:04 bobbieltd

For AEON, it’s already done by some people here. You can use CamTheGeek, I don’t have time to see AEON. Algo changes in C++ looks too complicated for me to understand.

bobbieltd avatar Apr 05 '18 14:04 bobbieltd

This didn't work for my Monero pool. I got these in my logs: 8|pool | 2018-04-05 15:58 +00:00: ReferenceError: cnHashing is not defined ... 8|pool | 2018-04-05 15:58 +00:00: Error [ERR_IPC_CHANNEL_CLOSED]: channel closed

78bash avatar Apr 05 '18 16:04 78bash

The XMR backends have been updated at this time w/ the MoneroOcean library for hashing. We've tested this in private, just been too blasted busy to catch up.

Snipa22 avatar Apr 05 '18 20:04 Snipa22

@Snipa22 Thank you!! Do we follow 78bash's process to update?

snoski3 avatar Apr 06 '18 03:04 snoski3

@bobbieltd @snoski3 - I updated the Monero Daemon to v0.12 a while back, and had to change my Wallet port, due to the Daemon using 2 ports. Didn't look into it much, but changed wallet port as it isn't much of an issue.

BKdilse avatar Apr 06 '18 10:04 BKdilse

@Snipa22 do we need to add anything to the process I mentioned?

78bash avatar Apr 06 '18 11:04 78bash

WARNING: The pool is rejecting results from my miner after my procedure. I'm using the latest miner version. @snoski3

My pool can be considered a test, no one's on it.

@BKdilse Is mining on your pool working for you? what else did you do exactly?

78bash avatar Apr 06 '18 12:04 78bash

@78bash Mining is working on my pool. I used what @bobbieltd mentioned eariler from Venthos's repo.

BKdilse avatar Apr 06 '18 13:04 BKdilse

@bobbieltd fix works, here's a patch:

package.json

diff --git a/package.json b/package.json
index bbfd876..cd00888 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,6 @@
   },
   "optionalDependencies": {
     "cryptonote-util": "git://github.com/Snipa22/node-cryptonote-util.git#xmr-Nan-2.0",
-    "multi-hashing": "git+https://github.com/Snipa22/node-multi-hashing-aesni.git#v0.1"
+    "cryptonight-hashing": "git://github.com/Venthos/node-cryptonight-hashing.git"
   }
 }


diff --git a/lib/coins/xmr.js b/lib/coins/xmr.js
index a452111..eecc16c 100644
--- a/lib/coins/xmr.js
+++ b/lib/coins/xmr.js
@@ -1,9 +1,10 @@
 "use strict";
 const bignum = require('bignum');
 const cnUtil = require('cryptonote-util');
-const multiHashing = require('multi-hashing');
+//const multiHashing = require('multi-hashing');
 const crypto = require('crypto');
 const debug = require('debug')('coinFuncs');
+const cnHashing = require('cryptonight-hashing');

 let hexChars = new RegExp("[0-9a-f]+");

@@ -162,8 +163,11 @@ function Coin(data){
         };
     };

-    this.cryptoNight = multiHashing.cryptonight;
-
+    //this.cryptoNight = multiHashing.cryptonight;
+      this.cryptoNight = function(convertedBlob) {
+       let cn_variant = convertedBlob[0] >= 7 ? convertedBlob[0] - 6 : 0;
+       return cnHashing.cryptonight(convertedBlob, cn_variant);
+       };
 }

 module.exports = Coin;

JPaulMora avatar Apr 06 '18 13:04 JPaulMora

@jpaulmora Thank you for the patch, which directory do I run it in?

snoski3 avatar Apr 06 '18 15:04 snoski3

@snoski3 after doing my procedure and @JPaulMora 's patches my pool runs great and is ready for v7. Run it in ~/nodejs-pool/ and ~/nodejs-pool/lib/coins/

78bash avatar Apr 06 '18 16:04 78bash

@JPaulMora I'm not a dev. Is this a pre-formatted Package.json?? When I save your patch into a file called package.json and do an npm run package.json, it kicks back an error saying "Failed to parse package.json data. Package.json must be actual JSON, not just JavaScript. " I tried running this from the nodejs-pool directory. Any idea here?

jredwine2857 avatar Apr 06 '18 23:04 jredwine2857

@78bash I can't seem to find line 1096 in any of the like 5 versions of tx_pool.cpp I have. In fact none have more than like 500 lines.

I have multiple in the /home/pooldaemon/nodejs folder and also in the /usr/local/src folder. Do you know which one specifically you updated?

"replace line no. 1096 of src/cryptonote_core/tx_pool.cpp with"

jredwine2857 avatar Apr 06 '18 23:04 jredwine2857

@jredwine2857 I just pulled the latest version, release-v0.12 branch. It's /usr/local/src/monero/src/cryptonote_core/tx_pool.cpp

This line change is to apply the monero_daemon.patch that's in the deployment folder

78bash avatar Apr 07 '18 01:04 78bash

@78bash Thanks for the response. I did a git pull but I still only have 1039 lines in /usr/local/src/monero/src/cryptonote_core/tx_pool.cpp. I'm pulling from snipa's repo. Odd to say the least that you have 1096 lines.

jredwine2857 avatar Apr 07 '18 02:04 jredwine2857

@jredwine2857 you cd into the pool's base directory (nodejs_pool by default) and paste that into a file, let's call it fork.patch. Then you just run patch < fork.patch command and everything should be OK.

Alternatively you can do it manually, by opening the files and replacing the lines that start with - and place the lines that start with +

EDIT: you also need to re-run npm install

JPaulMora avatar Apr 07 '18 03:04 JPaulMora

Doh! Yeah, Im def a newbie! Sorry for wasting your time on a Friday night! I'm a networking (Cisco)/infrastructure guy by trade so this stuff always gets me going sideways! God love you devheads! ;-) Thanks!

jredwine2857 avatar Apr 07 '18 03:04 jredwine2857

Did you edit the file after pulling from the monero repo? As per the instructions you should git pull while in /usr/local/src/monero

78bash avatar Apr 07 '18 05:04 78bash

Yeah, I have the new v0.12 and I can see its at the correct height. I finally have it working now.

I don't know if Snipa updated his repo or what, but all i had to do was do a git pull and npm install from the nodejs-pool directory and everything came up and I can now mine with XMR stak using monerov7 as the coin.

I.e. I didn't have to run the patch, just updated monerod and did a git pull and npm install.

Should I be worried that this isn't right? Pool is accepting shares and blockchain shows the correct v7 height.

jredwine2857 avatar Apr 07 '18 07:04 jredwine2857

Do a pm2 logs and make sure things look good. If so then it looks like you're set.

78bash avatar Apr 07 '18 08:04 78bash

Snipa updated this repo. Git pull & npm install . Monerod update too ofcourse

bobbieltd avatar Apr 07 '18 09:04 bobbieltd

That worked!! Just for good measure, I also ran pm2 restart all --update-env

snoski3 avatar Apr 07 '18 14:04 snoski3

While changing the code in tx_pool.cpp, upon make I keep errorring: /usr/local/src/monero/src/cryptonote_core/tx_pool.cpp:345:59: error: 'bl' was not declared in this scope

bruceleeon avatar Apr 19 '18 13:04 bruceleeon

@bruceleeon Fork the repo and remove this line in the deploy.bash : curl https://raw.githubusercontent.com/Snipa22/nodejs-pool/master/deployment/monero_daemon.patch | sudo git apply -v

bobbieltd avatar Apr 19 '18 16:04 bobbieltd

should be corrected in deploy.bash

sudo git clone https://github.com/monero-project/monero.git
cd monero
sudo git checkout v0.11.1.0

Teslo300 avatar May 11 '18 06:05 Teslo300