Snipa22 / nodejs-pool

Other
479 stars 421 forks source link

Upgrade after fork #380

Open snoski3 opened 6 years ago

snoski3 commented 6 years ago

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

Thanks

shigutso commented 6 years ago

you can get more info here:

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

78bash commented 6 years ago

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.

bobbieltd commented 6 years ago

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

78bash commented 6 years ago

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

bobbieltd commented 6 years ago

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 commented 6 years ago

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.

78bash commented 6 years ago

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

Snipa22 commented 6 years ago

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.

snoski3 commented 6 years ago

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

BKdilse commented 6 years ago

@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.

78bash commented 6 years ago

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

78bash commented 6 years ago

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?

BKdilse commented 6 years ago

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

JPaulMora commented 6 years ago

@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;
snoski3 commented 6 years ago

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

78bash commented 6 years ago

@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/

jredwine2857 commented 6 years ago

@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 commented 6 years ago

@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"

78bash commented 6 years ago

@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

jredwine2857 commented 6 years ago

@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.

JPaulMora commented 6 years ago

@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

jredwine2857 commented 6 years ago

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!

78bash commented 6 years ago

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

jredwine2857 commented 6 years ago

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.

78bash commented 6 years ago

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

bobbieltd commented 6 years ago

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

snoski3 commented 6 years ago

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

bruceleeon commented 6 years ago

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

bobbieltd commented 6 years ago

@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

Teslo300 commented 6 years ago

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
snoski3 commented 6 years ago

@Teslo300

Two things

  1. Shouldn't the checkout have been 12.0 instead of 11.1?
  2. Shouldn't the bash script now be updated for v.0.12.2.0, as that now how has been released?