geth 事件 new挂起事务不会发生



我已经用下一个命令运行了geth:

$ geth --testnet --networkid 3 --verbosity 3 --syncmode light --ipcdisable --ws --wsapi "db,eth,net,web3,personal,txpool,admin,miner" --wsorigins '*'

在第二个控制台中,我使用 wscat 连接到 geth jsonrpc .

订阅事件"newHeads"工作正常

$ wscat -c ws://localhost:8546
> {"id": 2, "method": "eth_subscribe", "params": ["newHeads"]}
< {"jsonrpc":"2.0","id":2,"result":"0x660135584e36a9edb0c55f89c389848"}
< {"jsonrpc":"2.0","method":"eth_subscription","params":{"subscription":"0x660135584e36a9edb0c55f89c389848","result":{"parentHash":"0xe7d0...","hash":"0x1dcc...

但是订阅事件"newPendingTransactions"不起作用

$ wscat -c ws://localhost:8546
> {"id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}
< {"jsonrpc":"2.0","id":1,"result":"0x511b3274aa5dec44bb79d178c238e7fe"}

这就是全部:我没有收到新的待处理交易。

在 ropsten.infura.io 上订阅事件"newPendingTransactions"工作正常

$ wscat -c wss://ropsten.infura.io/ws
> {"id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}
< {"jsonrpc":"2.0","id":1,"result":"0x18fda7bf20ee9c5b5f1f08edf5c3e482"}
< {"jsonrpc":"2.0","method":"eth_subscription","params":{"subscription":"0x18fda7bf20ee9c5b5f1f08edf5c3e482","result":"0xc1e00266ab9f2c512d6c1967c300fc00381586e868611b7dff6fd94f230dd707"}}

信息:

$ geth version
Geth
Version: 1.8.22-stable
Git Commit: 7fa3509e2eaf1a4ebc12344590e5699406690f15
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.4
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go-1.10

我有两个问题:

1. 为什么订阅"新待处理交易"事件不起作用?

2. 我做错了什么?

问题是我没有等待同步结束。

从头开始(这次我使用了Rinkeby网络):

geth --rinkeby --verbosity 3 --syncmode fast --ipcdisable --ws --wsapi "db,eth,net,web3,personal,txpool,admin" --wsorigins '*'

对于 Rinkeby 网络,这大约需要 20 个小时,而我的 SSD 上的区块链大小约为 25 GB。

现在订阅新待处理交易事件工作正常

谢谢大家!

最新更新