-
Notifications
You must be signed in to change notification settings - Fork 37.7k
-blocknotify : run a command when best-block changes #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -227,6 +227,7 @@ bool AppInit2(int argc, char* argv[]) | |||
" -rpcport=<port> \t\t " + _("Listen for JSON-RPC connections on <port> (default: 8332)") + "\n" + | |||
" -rpcallowip=<ip> \t\t " + _("Allow JSON-RPC connections from specified IP address") + "\n" + | |||
" -rpcconnect=<ip> \t " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" + | |||
" -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too long for standard terminals (79 chars wide), and doesn't fit with the style used by the other options (minimum two spaces between parameter and description).
visual ACK (== I did not build or test it, only a github conceptual review) |
Gavin, this branch is missing in your repo...? |
@@ -1336,6 +1346,14 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew) | |||
nTransactionsUpdated++; | |||
printf("SetBestChain: new best=%s height=%d work=%s\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str()); | |||
|
|||
std::string strCmd = GetArg("-blocknotify", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be somewhat cleaner to make strCmd a global, and fill it in init.cpp, so that GetArgs happen in the one function as much as possible, and not parsed every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A global puts the information in two places (the mapArgs array and the global), which I think would be a mistake-- if the information is in two places, then then it is possible that those two places will get ouf of sync.
I also like being able to grep for the command-line option to find all the code that deals with that option.
There is no possible performance issue, since blocknotify will trigger once every 10 minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fair enough
I removed this branch accidently-- restored. |
-blocknotify : run a command when best-block changes
-blocknotify : run a command when best-block changes
…directories - Remove sudo: required - Use addons to install apt packages - Use pip to install pyzmq - Use wine package from precise, so running windows binary for test need to call via wine. Closes bitcoin#743
…1.1.1.0 Add BUcash 1.1.1.0 release notes
This re-implements pull#714, using system() (which does work on Windows) and boost::thread().
Help text is:
-blocknotify=<cmd> Execute command when the best block changes (%s in cmd is replaced by block hash)
Example usage (this is how I tested):
./bitcoind -blocknotify="./bitcoind getblock %s >> /tmp/blocks.txt"