2018-06-04 21:10:59 +00:00
|
|
|
// Package txpool handles incoming transactions for a sharded Ethereum blockchain.
|
|
|
|
package txpool
|
|
|
|
|
|
|
|
import (
|
2018-06-20 03:59:02 +00:00
|
|
|
"github.com/ethereum/go-ethereum/event"
|
2018-07-24 15:21:58 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/p2p"
|
2018-07-21 17:51:18 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2018-06-04 21:10:59 +00:00
|
|
|
)
|
|
|
|
|
2018-07-21 17:51:18 +00:00
|
|
|
var log = logrus.WithField("prefix", "txpool")
|
|
|
|
|
2018-06-13 12:44:33 +00:00
|
|
|
// TXPool handles a transaction pool for a sharded system.
|
|
|
|
type TXPool struct {
|
2018-06-20 03:59:02 +00:00
|
|
|
p2p *p2p.Server
|
|
|
|
transactionsFeed *event.Feed
|
2018-06-05 21:28:57 +00:00
|
|
|
}
|
2018-06-04 21:10:59 +00:00
|
|
|
|
2018-06-13 12:44:33 +00:00
|
|
|
// NewTXPool creates a new observer instance.
|
|
|
|
func NewTXPool(p2p *p2p.Server) (*TXPool, error) {
|
2018-06-20 03:59:02 +00:00
|
|
|
return &TXPool{p2p: p2p, transactionsFeed: new(event.Feed)}, nil
|
2018-06-04 21:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Start the main routine for a shard transaction pool.
|
2018-06-13 12:44:33 +00:00
|
|
|
func (p *TXPool) Start() {
|
2018-06-04 21:10:59 +00:00
|
|
|
log.Info("Starting shard txpool service")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop the main loop for a transaction pool in the shard network.
|
2018-06-13 12:44:33 +00:00
|
|
|
func (p *TXPool) Stop() error {
|
2018-06-04 21:10:59 +00:00
|
|
|
log.Info("Stopping shard txpool service")
|
|
|
|
return nil
|
|
|
|
}
|