I am running two nodes in a testnet.
Node1 = miner and Node2 = peer of Node1
I suscribe to both nodes with
web3.eth.subscribe('newBlockHeaders') since I want to obtain when a block with a transaction is added in node2.
I am running a script and, first, I get a notification of the block X from node1 and node2, but I dont understand why if I make a transaction AFTER this notification from node1, it is added to the block X (which is already in node2). So, I think I am not getting the block when it is added to the node2. Could anyone explain me this behaviour? Is there other way to get when a transaction is added to a node?