When running geth console I'd like to get pending transactions from the admin object. (as mentioned by @obscuren)
you can get pending transactions via the eth object:
eth.getBlock(-2, true).transactions
-2 stands for pending block, true to include transaction objects
I documented the magic numbers -1/-2 in JS API wiki https://github.com/ethereum/wiki/wiki/JavaScript-API
let me know if this is not what you need
Thanks this looks good.
Is there a way to get it with RPC (in case scripts need)? Also, I usually run geth cli instead of console, and is there a way that I can access this? I know I can't run get console since db already open, but maybe there's some other way?
On second thought this is probably not what you want.
-------- Original message --------
From: ethers [email protected]
Date:22/04/2015 04:46 (GMT+00:00)
To: ethereum/go-ethereum [email protected]
Cc: Viktor Trón viktor.[email protected]
Subject: Re: [go-ethereum] console "admin" feature to view pending
transactions (#675)
Thanks this looks good.
Is there a way to get it with RPC (in case scripts need)? Also, I usually run geth cli instead of console, and is there a way that I can access this? I know I can't run get console since db already open, but maybe there's some other way?
—
Reply to this email directly or view it on GitHub.
The -1 and -2 should not be documented. These are only for internal usage. The canonical way of doing this is by supplying "latest" or "pending".
agree
me too :) but so then it needs to be implemented in go rpc/xeth for
eth.getBlocketh.getBlockTransactionCounteth.getTransactionFromBlock and eth.getUncle@obscuren But as for the original issue: will my solution (using getBlock("pending")) work if we are not mining?
Cos then no pending block is created right?
Yet we do send transactions and until they are confirmed in a block, they are pending.
pending blocks are always created regardless of mining. So yes, still works.
guys this is really just working now as it should. so I am closing this
eth.getBlock("pending", true).transactions
Most helpful comment
guys this is really just working now as it should. so I am closing this