0

I made a private network with only one node in it, then I sent 2000 transactions like so:

var amount = 1;
var sender = personal.listAccounts[0]
var receiver = personal.listAccounts[0]
for (i = 0; i < 2000; ++i) {
   eth.sendTransaction({from:sender, to:receiver, value: amount});
}

Then, I can see that there are 2000 transactions in the txpool, so I start to mine and this was the result:

INFO [10-10|16:12:25] Commit new mining work                   number=2684 txs=221 uncles=0 elapsed=1h10m51.957s

Looking at the source code, I have found that in the function commitTransactions in worker.go:

func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsByPriceAndNonce, bc *core.BlockChain, coinbase common.Address) {
    fmt.Println("commitTransactions")
    gp := new(core.GasPool).AddGas(env.header.GasLimit)

    var coalescedLogs []*types.Log
    //var i int = 0
    for {
        // Retrieve the next transaction and abort if all done
        tx := txs.Peek()
        //i+=1
        if tx == nil {
            break
        }

tx := txs.Peek() returns nil after 221 times, but I don't know why. Would you please help me?

My geth version is

v1.6.6-unstable/windows-amd64/go1.9beta2
  • What is the gas limit for your blocks? – lungj Oct 10 '17 at 13:23
  • @jiebang In an unmodified geth each transfer cost 21000 gas. Since you cannot include 222 transactions your gas limit is below 222x21000 = 4662000 gas. If you need to include more transfer you need a higher block gas limit. – Ismael Oct 10 '17 at 14:37
  • where is the block gas limit setting ? I cannot find it. – jiebang Oct 11 '17 at 3:25

Your Answer

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

Browse other questions tagged or ask your own question.