Bitcoin Forum
April 24, 2024, 11:54:53 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: blkmond lite  (Read 6501 times)
metonymous (OP)
Newbie
*
Offline Offline

Activity: 29
Merit: 0


View Profile
May 18, 2011, 03:27:59 PM
 #1

hey all, I couldn't grok blkmond, or seemingly get it working. it runs and sits there... doing nothing even when a block turns up. Anyway;

from that engineering "do it yourself" mentality I wrote a substitute that operates in possibly the least efficient way possible, it just polls bitcoind over RPC ever 0.1 of a second. Huzzah! Anyway it works, and it's a "fixed cost" work, it won't increase usage if you increase pool size.

I jokingly called it pollpokepush.py (it's even fun to say!),

To get it working:
Code:
#!/usr/bin/env python
from jsonrpc.authproxy import AuthServiceProxy
import sys
import os

access = AuthServiceProxy("http://RPCUSER:RPCPASS@127.0.0.1:8332")
blockcount = access.getblockcount()
from time import sleep
while(True):
        newcount = access.getblockcount()
        if newcount > blockcount:
                os.system("killall -s SIGUSR1 pushpoold")
                sys.stdout.write("B")
                sys.stdout.flush()
                blockcount = newcount
                sleep(1)
        else:
                sleep(0.1)

1714002893
Hero Member
*
Offline Offline

Posts: 1714002893

View Profile Personal Message (Offline)

Ignore
1714002893
Reply with quote  #2

1714002893
Report to moderator
1714002893
Hero Member
*
Offline Offline

Posts: 1714002893

View Profile Personal Message (Offline)

Ignore
1714002893
Reply with quote  #2

1714002893
Report to moderator
1714002893
Hero Member
*
Offline Offline

Posts: 1714002893

View Profile Personal Message (Offline)

Ignore
1714002893
Reply with quote  #2

1714002893
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714002893
Hero Member
*
Offline Offline

Posts: 1714002893

View Profile Personal Message (Offline)

Ignore
1714002893
Reply with quote  #2

1714002893
Report to moderator
xmasterpx
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile
June 17, 2011, 08:39:46 AM
 #2

Yep i had the same problem.
Running Running Running and its doing nothing.

Your little skript works very well. thanks
lemosax
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
June 19, 2011, 07:01:33 AM
 #3

This works beautifully.  I could not get blkmond working at all, but your script does the trick, and the clients clearly show the "long poll: new block"

Thanks!
phorensic
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
July 12, 2011, 06:29:35 PM
 #4

After two weeks of working flawlessly, blkmond decided it didn't want to send SIGUSR1 anymore.  It was monitoring fine, but not sending the signal.  I just implemented your script on our pool, and it works like magic!  Thanks.
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
July 13, 2011, 05:41:19 AM
Last edit: July 17, 2011, 02:25:00 AM by JoelKatz
 #5

You can use my native long polling patch for bitcoind. It's this simple:

diff -up orig/main.cpp new/main.cpp
--- orig/main.cpp       2011-07-03 17:36:31.538080064 -0700
+++ new/main.cpp        2011-07-03 19:31:18.396649894 -0700
@@ -1586,6 +1586,20 @@ bool CBlock::SetBestChain(CTxDB& txdb, C
     // Update best block in wallet (so we can detect restored wallets)
     if (!IsInitialBlockDownload())
     {
+        // Support long polling
+        string lp_pid=mapArgs["-pollpidfile"];
+        if(lp_pid != "")
+        {
+            FILE *pidFile = fopen(lp_pid.c_str(), "r");
+            if(pidFile!=NULL)
+            {
+                int pid=0;
+                if ((fscanf(pidFile, "%d", &pid) == 1) && (pid>1))
+                    kill((pid_t) pid, SIGUSR1);
+                fclose(pidFile);
+            }
+        }
+    
         CWalletDB walletdb;
         const CBlockLocator locator(pindexNew);

Then just start bitcoind with '-pollpidfile=/var/run/pushpoold.pid' (or whatever the path to your pid file is from your config). Do not use this patch and use anything else to send a SIGUSR1 to pushpoold! (Bitcoind and pushpoold must run as the same user or this won't work.)

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
phorensic
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
July 13, 2011, 04:35:27 PM
 #6

JoelKatz, I love the work you have done on bitcoind and I will be using your patches soon.  I would like to see your fork (maintained by the other guy on Github) become a bit more stable on the larger pools and I will start running it.
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
July 13, 2011, 04:57:53 PM
 #7

JoelKatz, I love the work you have done on bitcoind and I will be using your patches soon.  I would like to see your fork (maintained by the other guy on Github) become a bit more stable on the larger pools and I will start running it.
Thanks. He's done a good job of porting it to 0.3.24 and maintaining it. I'm glad someone did that, as I haven't had the time lately. I may be having a lot more free time in the next week or so, so I hope get back to it aggressively.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
froggy
Full Member
***
Offline Offline

Activity: 127
Merit: 100


View Profile WWW
July 16, 2011, 01:14:31 PM
Last edit: July 16, 2011, 01:31:17 PM by froggy
 #8

Excellent stuff, JoelKatz.  Can I just check...
Quote

Then just start bitcoind with '-pollpidfile=/var/run/pushpoold.pid'.

I take it that if I have in pushpool's server.json  file...
Code:
   "pid" : "/tmp/pushpoold.pid",
Then I should be using
Code:
 bitcoind -pollpidfile=/tmp/pushpool.pid'. 
Would you be kind enough to confirm this?

Many huge thanks!
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
July 16, 2011, 05:12:14 PM
 #9

Would you be kind enough to confirm this?
Yes.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
Furyan
Full Member
***
Offline Offline

Activity: 175
Merit: 100



View Profile
July 17, 2011, 02:12:49 AM
 #10

JoelKatz, I love the work you have done on bitcoind and I will be using your patches soon.  I would like to see your fork (maintained by the other guy on Github) become a bit more stable on the larger pools and I will start running it.
Thanks. He's done a good job of porting it to 0.3.24 and maintaining it. I'm glad someone did that, as I haven't had the time lately. I may be having a lot more free time in the next week or so, so I hope get back to it aggressively.

Are you referring to Jine's fork of pushpool where you've implemented the long polling and keep-alives in pp?

I love that work too... I just got the stock codebases of bitcoind and pushpool compiled and working but I think I'm going to use your patches instead... much more elegant.
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
July 17, 2011, 02:24:14 AM
 #11

I recently rebased to 0.3.24 and included a few other micro-optimizations.
http://davids.webmaster.com/~davids/bitcoin-4diff.txt

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
Furyan
Full Member
***
Offline Offline

Activity: 175
Merit: 100



View Profile
July 17, 2011, 02:43:31 AM
 #12

I recently rebased to 0.3.24 and included a few other micro-optimizations.
http://davids.webmaster.com/~davids/bitcoin-4diff.txt


Blargh. My copy is bleeding-edge git.  Why you have to make it hard?  Grin
TeraPool
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
July 18, 2011, 02:59:19 AM
 #13

I recently rebased to 0.3.24 and included a few other micro-optimizations.
http://davids.webmaster.com/~davids/bitcoin-4diff.txt


Blargh. My copy is bleeding-edge git.  Why you have to make it hard?  Grin

Isn't that kind of risky for a production server anyways?
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
July 18, 2011, 03:09:35 AM
 #14

Isn't that kind of risky for a production server anyways?
Yeah, but without people who take that risk, we could never have confidence in the code we are releasing. It's thanks to the folks who first ran my code on live servers that the code is reasonably stable today. So thank him for taking that risk so that you don't have to. (Assuming he's watching it closely. Otherwise, he's just being stupid.)

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
Furyan
Full Member
***
Offline Offline

Activity: 175
Merit: 100



View Profile
July 18, 2011, 02:28:12 PM
 #15

Isn't that kind of risky for a production server anyways?
Yeah, but without people who take that risk, we could never have confidence in the code we are releasing. It's thanks to the folks who first ran my code on live servers that the code is reasonably stable today. So thank him for taking that risk so that you don't have to. (Assuming he's watching it closely. Otherwise, he's just being stupid.)

For the moment, the only one taking the risk is me and a couple of others.  And yes, I am watching it closely.

I don't have the production/test server division fully built out yet but when I do, this ceases to be an issue. Crash test dummies can have at it if they wish.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!