Author

Topic: Wallet notify sometimes doesn't notify (Read 233 times)

legendary
Activity: 1624
Merit: 2481
May 09, 2018, 03:05:04 AM
#5
Just a quick head up: As you hinted, walletnotify is only ran when tx is received in the mempool (confirmation = 0) & when included in a block (confirmation = 1), but you wrote 
Code:
if( $txinfo['confirmations'] >= 3 ) 

It is likely confirmation >= 3 will never be executed.

You are right. I somehow missed this  Grin
Thanks for correcting me, i edited my post. I appreciate it.
full member
Activity: 198
Merit: 130
Some random software engineer
Basically a script would look like this if you call it with 'bitcoind -walletnotify=/path/to/script.php %s':
Code:
$tx $argv[1];
$txinfo json_decode( `bitcoin-cli gettransaction $tx` );
if( 
$txinfo['confirmations'] >= ) {
    
// update mysql if necessary.
}

Keep in mind that walletnotify does get called two times. First time it received a transaction and after it got one confirmation.
If you want to track whether a specific TX got more than one confirmation, you have to use blocknotify.

Just a quick head up: As you hinted, walletnotify is only ran when tx is received in the mempool (confirmation = 0) & when included in a block (confirmation = 1), but you wrote 
Code:
if( $txinfo['confirmations'] >= 3 ) 

It is likely confirmation >= 3 will never be executed.
legendary
Activity: 1624
Merit: 2481
Did you check your logs whether your script does work properly?
You can log any event you wish with the -debug parameter. To enable debug log, put -debug=rpc as commandline parameter when starting bitcoind.
Chances are high there is a small bug in your script logic.


Basically a script would look like this if you call it with 'bitcoind -walletnotify=/path/to/script.php %s':
Code:
$tx $argv[1];
$txinfo json_decode( `bitcoin-cli gettransaction $tx` );
if( 
$txinfo['confirmations'] >= ) {
    
// update mysql if necessary.
}


Keep in mind that walletnotify does get called two times. First time it received a transaction and after it got one confirmation.
If you want to track whether a specific TX got more than one confirmation, you have to use blocknotify.
member
Activity: 126
Merit: 50
Ask me for Pools, Nodes and Explorers.
I think that it might be a bug with your script rather than bitcoin software. No one can help you, if you don't show the script to us.
newbie
Activity: 2
Merit: 0
I've setup my own server to run bitcoind, and I've used walletnotify to update incoming transactions into database through CURL php script. But I noticed not all incoming transactions were recorded after I my testing. The coins I sent were all received in the server, but database only recorded part of it, so I doubt walletnotify didn't notify in some cases. Any idea what's the cause for this?  Huh
Jump to: