aboutsummaryrefslogblamecommitdiff
path: root/miner/worker.go
blob: ec34bdf9a428d8c736e846c08b1f5d9e45fd2b83 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                  
                                                   










                                                         
               

                                               








                                                        











































































































































                                                                                                                                     

                         

 
                                                                                                                                                                         





















                                                                                             

                                                        




















































































                                                                                                                    
                             






                                             

 

























































                                                                                                             



                                                                     



                                                            



                                                                     









                                                                                                              
                                                            
































































                                                                                                                                    
                                                                                                                      




































































































































































                                                                                                                                                   
                                                                                             
                                                                                             
                                                                                             




































































































































































































































































































































                                                                                                                                                                                                
                                       

                                                                                                                     
                                      









                                                                             
                                                 






















                                                                                        
                              










































                                                                                                                                                                             
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//
// NOTE: this piece of code is modified by Ted Yin.
// The modification is also licensed under the same LGPL.

package miner

import (
	"bytes"
	"errors"
	"math/big"
	"sync"
	"sync/atomic"
	"time"
	//"fmt"

	mapset "github.com/deckarep/golang-set"
	"github.com/ava-labs/go-ethereum/common"
	"github.com/ava-labs/go-ethereum/consensus"
	"github.com/ava-labs/go-ethereum/consensus/misc"
	"github.com/ava-labs/go-ethereum/core"
	"github.com/ava-labs/go-ethereum/core/state"
	"github.com/ava-labs/go-ethereum/core/types"
	"github.com/ava-labs/go-ethereum/event"
	"github.com/ava-labs/go-ethereum/log"
	"github.com/ava-labs/go-ethereum/params"
)

const (
	// resultQueueSize is the size of channel listening to sealing result.
	resultQueueSize = 10

	// txChanSize is the size of channel listening to NewTxsEvent.
	// The number is referenced from the size of tx pool.
	txChanSize = 4096

	// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
	chainHeadChanSize = 10

	// chainSideChanSize is the size of channel listening to ChainSideEvent.