目前,我正在通过循环进入最新的200个块来使用GetBlockWithTransactionsByNumber,以便将事务发送到我的地址。实际上,我可以通过块号获得我的事务,但是对于挂起的事务,它还没有块号(还没有挖掘到块)呢?

发布于 2018-03-13 04:42:57
可以查询txpool_content检查属性,以列出当前待包含在下一个块(S)中的所有事务的确切细节,以及计划仅用于未来执行的事务。
参考资料:https://github.com/ethereum/go-ethereum/wiki/Management-APIs#txpool
此API不是直接的available.So,您可以使用以下代码集成txpool_content API。
web3.currentProvider.sendAsync({
method: "txpool_content",
params: [],
jsonrpc: "2.0",
id: new Date().getTime()
}, function(error, result) {
console.log(result);
if (result.result.pending) {
if (result.result.pending[address]) { //address -external input
var txnsCount =
Object.keys(result.result.pending[consumerAddress]).length;
console.log("txnsCount: "+txnsCount);
}
}
})https://ethereum.stackexchange.com/questions/42465
复制相似问题