openethereum / parity-ethereum

The fast, light, and robust client for Ethereum-like networks.
Other
6.83k stars 1.68k forks source link

[question] subscribe to pending transactions - node miss some transactions #11817

Open or2008 opened 4 years ago

or2008 commented 4 years ago

Hi, I am using web3 to subscribe for pending transactions, and i am receiving a lot of pending transactions. However I noticed there are transactions that Parity "doesn't see", I mean I can see those transactions on etherscan, but not on my node.

Any idea how can I improve Parity so it doesn't loose transactions? Does increase the minPeers help? If so what is the recommended number of peers?

diadal commented 4 years ago

I have same similar question how to identify which transaction belong to wallet without have to check all this list pending transactions is there any way like "own_tx=trace" to monitor only my account addresses

@or2008 try check

 web3.eth.subscribe('newBlockHeaders', function (error, result) {
            console.error(error);
        })  .on("connected", function (subscriptionId) {
            console.log('subscriptionId :>> ', subscriptionId);
        })  .on("data", (blockHeader) => {
            web3.eth.getBlock(blockHeader.hash, true).then(async (r) => {
                var txs = r.transactions
                console.log('acclist :>> ', acclist);
                txs.forEach(async  (txId) => {
                    console.log('txId :>> ', txId);
                })
            });

        }) .on("error", console.error);