0

I'm using the abigen tool to interact with smart contracts in golang and am a bit confused about the Pending variable in the CallOpts.

I've been searching around for documentation about the argument but couldn't find anything. The godoc specifies this.

type CallOpts struct {
    Pending bool           // Whether to operate on the pending state or the last known one

What exactly is the pending state? Most examples have this set to true but i'm not sure why.

0

The Pending flag means wether to query transactions that are in the node's mempool which are not yet processed and acknowledged by the network as being part of the canonical chain.

For example, if you broadcast a transfer transaction and then immediately fetch the balance of account with pending enabled then you'll get back the account balance as if the transaction had already been committed to the chain but with pending off you'll get back the unmodified current balance. Once the transaction has 1 confirmation then the transaction will no longer be pending.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.