Go-Ethereum – How to Include Transactions into Blocks When Space is Available?

cliquego-ethereumpoa

  • Geth version: 1.8.12-stable
  • OS & Version: Linux/OSX

Expected Behavior

Transactions to distributed to network right at its sent block number and deployed within that.


Actual Behavior

Transactions are delayed one block time to be distributed over network and consequently deployed one block time late.


Explanation

I have a small cluster that is connected to private Ethereum chain that uses POA and block time is fixed 15 seconds. The cluster has four nodes that all nodes are connected to each other. Please note that, there is three signer nodes on my cluster.

When I submit a transaction from a node; the transaction does not reach to all signer nodes on the current block but it is transferred onto the next block. But, I observe that the sent transaction was received by the non-signer node right after it is sent.

For example; when I sent a transaction within the current block, it will not deployed on the current block but on the up coming block. So this forces network to deploy a transaction in 2 block time which is in between 15 seconds to 30 seconds.

So if I sent my transaction on 1st second of the block, first I need to wait 14 seconds for next block to come. And wait additional 15 seconds more on the next block for that transaction to be deployed, so in total I need to wait 29 seconds.


Example case:
alper@home is non-signer node and other nodes are signer node.

I sent a transaction within block number 869,334 from node named eBloc@netlab (signer-node) and transaction shows up right after at alper@home named node (non-signer node) on block number 869,334 but it does not show up on the signer nodes even on the node that I sent it from.

enter image description here

On the next block (869,335) I observe that all nodes receive the transactions.

enter image description here

And finally on block number (869,336) the transaction is deployed.

enter image description here

=> If the transaction was distributed to all cluster right after it sent it should be deployed on the block number (869,334) but it used 1 additional block time for this.

[Q1] Why the sent transaction received by the non-signer nodes right after it is sent but not by the signer nodes?

[Q2] Is this normal that the sent transaction won't transfer to all the network right after it is sent but it takes additional 1 block time even all nodes are connected to each other? Is there any way to force to transfer a transaction to all my signer nodes right after it has been sent?

Note: Further discussion could be seen on a opened issue on go-ethereum.

Best Answer

This issue has been solved by the go-ethereum team.

@karalabe:

The transaction should propagate across the network at the same time.

It however is not included in the current block, because the block currently being mined is already finalized. It's expensive to recreate a new block every time a new transaction pops up. And in the case of mainnet, the blocks are full either way so it doesn't make much sense. This is why there's always 1 block delay between submitting and mining.

For testnets though, we have some code that reworks the miner and among other, we also want to have functionality to immediately include transactions into blocks if there is still space.


We've reworked the miner on the master branch. The current code will regenerate blocks every 3 seconds while mining, so if there are more/better transactions to fir in, the node will chose them.

Related Topic