Why does walletnotify happen three times?

My bitcoin walletnotify happens three times. Once, when a new transaction is received, and twice, when there is confirmation. I need to know if this is good? Because wherever I could read, I found that walletnotify should only happen twice. Once, when the transaction, once, at the first confirmation.

here is a sample of my bitcoin.conf:

rpcuser=user
rpcpassword=password
walletnotify=/usr/bin/php /path/to/script/notify.php %s

here is the template of my script in php:

if(2 == $argc) {
        $bitcoin = new Bitcoin(USER, PASS);

        $transaction = $bitcoin->gettransaction($argv[1]);
        $confCount = $transaction['confirmations'];
        if ($confCount > 0) {

            ob_start();
            var_dump($transaction);
            $output = ob_get_clean();
            file_put_contents('notifylog.txt', $output, FILE_APPEND);
        }
}

It checks whether the transaction is confirmed or not, and writes to the log. However, he writes 2 times. What for? Should it be like that?

+4
source share
1 answer

, , , , : walletnotify .

1- - (0 conf)

2- 1 .

, "" .

+3

All Articles