electrs icon indicating copy to clipboard operation
electrs copied to clipboard

Duplicate script hash subscription notification?

Open jakub-msqt opened this issue 6 months ago • 2 comments

blockchain.scripthash.subscribe

On regtest, when I mine a block with unconfirmed transaction, I get 2 notifications from the subscription method above. Each has a different status hash.

I've got a logic tied to this notification and I'd like to NOT run it twice after the transaction is confirmed.

Is this intended behaviour?

jakub-msqt avatar Jul 28 '25 17:07 jakub-msqt

I've solved it for my case by hashing the result of blockchain.scripthash.get_history and skipping further processing for the duplicate notification. I've assumed that's what the electrum server does to generate status hash but apparently there are more inputs.

Still curious to hear why is there a duplicate notification.

jakub-msqt avatar Aug 01 '25 09:08 jakub-msqt

It's possible there is a race between updating the mempool, and detecting a new block so you are getting 2 notifications instead of 1.

romanz avatar Aug 05 '25 16:08 romanz