Moved txpool start to initialisation method of ethereumm

poc8
obscuren 11 years ago
parent a4a4ffbeff
commit 3a45cdeaf9
  1. 11
      ethereum.go

@ -47,6 +47,7 @@ type Ethereum struct {
Nonce uint64 Nonce uint64
Addr net.Addr Addr net.Addr
Port string
peerMut sync.Mutex peerMut sync.Mutex
@ -93,6 +94,9 @@ func New(caps Caps, usePnp bool) (*Ethereum, error) {
ethereum.TxPool.BlockManager = ethereum.BlockManager ethereum.TxPool.BlockManager = ethereum.BlockManager
ethereum.BlockManager.TransactionPool = ethereum.TxPool ethereum.BlockManager.TransactionPool = ethereum.TxPool
// Start the tx pool
ethereum.TxPool.Start()
return ethereum, nil return ethereum, nil
} }
@ -229,7 +233,7 @@ func (s *Ethereum) ReapDeadPeerHandler() {
// Start the ethereum // Start the ethereum
func (s *Ethereum) Start() { func (s *Ethereum) Start() {
// Bind to addr and port // Bind to addr and port
ln, err := net.Listen("tcp", ":30303") ln, err := net.Listen("tcp", ":"+s.Port)
if err != nil { if err != nil {
log.Println("Connection listening disabled. Acting as client") log.Println("Connection listening disabled. Acting as client")
} else { } else {
@ -246,9 +250,6 @@ func (s *Ethereum) Start() {
// Start the reaping processes // Start the reaping processes
go s.ReapDeadPeerHandler() go s.ReapDeadPeerHandler()
// Start the tx pool
s.TxPool.Start()
if ethutil.Config.Seed { if ethutil.Config.Seed {
ethutil.Config.Log.Debugln("Seeding") ethutil.Config.Log.Debugln("Seeding")
// Testnet seed bootstrapping // Testnet seed bootstrapping
@ -306,7 +307,7 @@ func (s *Ethereum) upnpUpdateThread() {
// Go off immediately to prevent code duplication, thereafter we renew // Go off immediately to prevent code duplication, thereafter we renew
// lease every 15 minutes. // lease every 15 minutes.
timer := time.NewTimer(0 * time.Second) timer := time.NewTimer(0 * time.Second)
lport, _ := strconv.ParseInt("30303", 10, 16) lport, _ := strconv.ParseInt(s.Port, 10, 16)
first := true first := true
out: out:
for { for {

Loading…
Cancel
Save