everything but binary, common, and blocks are explicitly imported.

This commit is contained in:
Jae Kwon
2014-10-16 16:00:48 -07:00
parent 300f12dd63
commit ac147e2353
13 changed files with 84 additions and 75 deletions
+5 -5
View File
@@ -13,17 +13,17 @@ import (
. "github.com/tendermint/tendermint/binary"
. "github.com/tendermint/tendermint/blocks"
. "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/state"
)
type Mempool struct {
mtx sync.Mutex
lastBlock *Block
state *State
state *state.State
txs []Tx
}
func NewMempool(lastBlock *Block, state *State) *Mempool {
func NewMempool(lastBlock *Block, state *state.State) *Mempool {
return &Mempool{
lastBlock: lastBlock,
state: state,
@@ -45,7 +45,7 @@ func (mem *Mempool) AddTx(tx Tx) (err error) {
// Returns a new block from the current state and associated transactions.
// The block's Validation is empty, and some parts of the header too.
func (mem *Mempool) MakeProposalBlock() (*Block, *State) {
func (mem *Mempool) MakeProposalBlock() (*Block, *state.State) {
mem.mtx.Lock()
defer mem.mtx.Unlock()
nextBlock := mem.lastBlock.MakeNextBlock()
@@ -57,7 +57,7 @@ func (mem *Mempool) MakeProposalBlock() (*Block, *State) {
// "state" is the result of state.AppendBlock("block").
// Txs that are present in "block" are discarded from mempool.
// Txs that have become invalid in the new "state" are also discarded.
func (mem *Mempool) ResetForBlockAndState(block *Block, state *State) {
func (mem *Mempool) ResetForBlockAndState(block *Block, state *state.State) {
mem.mtx.Lock()
defer mem.mtx.Unlock()
mem.lastBlock = block
+6 -6
View File
@@ -8,7 +8,7 @@ import (
. "github.com/tendermint/tendermint/binary"
. "github.com/tendermint/tendermint/blocks"
. "github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/p2p"
)
var (
@@ -17,7 +17,7 @@ var (
// MempoolReactor handles mempool tx broadcasting amongst peers.
type MempoolReactor struct {
sw *Switch
sw *p2p.Switch
quit chan struct{}
started uint32
stopped uint32
@@ -25,7 +25,7 @@ type MempoolReactor struct {
mempool *Mempool
}
func NewMempoolReactor(sw *Switch, mempool *Mempool) *MempoolReactor {
func NewMempoolReactor(sw *p2p.Switch, mempool *Mempool) *MempoolReactor {
memR := &MempoolReactor{
sw: sw,
quit: make(chan struct{}),
@@ -58,14 +58,14 @@ func (memR *MempoolReactor) BroadcastTx(tx Tx) error {
}
// Implements Reactor
func (pexR *MempoolReactor) AddPeer(peer *Peer) {
func (pexR *MempoolReactor) AddPeer(peer *p2p.Peer) {
}
// Implements Reactor
func (pexR *MempoolReactor) RemovePeer(peer *Peer, err error) {
func (pexR *MempoolReactor) RemovePeer(peer *p2p.Peer, err error) {
}
func (memR *MempoolReactor) Receive(chId byte, src *Peer, msgBytes []byte) {
func (memR *MempoolReactor) Receive(chId byte, src *p2p.Peer, msgBytes []byte) {
_, msg_ := decodeMessage(msgBytes)
log.Info("MempoolReactor received %v", msg_)