mempool: Remove exported InsertVote function. (#483)

Vote insertion is an internal mempool operation and thus should not be
exposed to callers outside of the package.  It also had an undocumented
assumption that the provided tx had already passed stake.IsSSGen checks
which is yet another reason the function shouldn't be exposed.
This commit is contained in:
Dave Collins 2016-11-22 12:04:42 -06:00 committed by Alex Yocom-Piatt
parent 3526f520e4
commit 448d0bbd4e

View File

@ -220,16 +220,6 @@ func (mp *txMemPool) insertVote(ssgen *dcrutil.Tx) error {
return nil
}
// InsertVote inserts a vote into the map of block votes.
//
// This function is safe for concurrent access.
func (mp *txMemPool) InsertVote(ssgen *dcrutil.Tx) error {
mp.votesMtx.Lock()
defer mp.votesMtx.Unlock()
return mp.insertVote(ssgen)
}
// getVoteHashesForBlock gets the transaction hashes of all the known votes for
// some block on the blockchain.
func (mp *txMemPool) getVoteHashesForBlock(block chainhash.Hash) ([]chainhash.Hash, error) {
@ -1218,7 +1208,9 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *dcrutil.Tx, isNew,
// If it's an SSGen (vote), insert it into the list of
// votes.
if txType == stake.TxTypeSSGen {
err := mp.InsertVote(tx)
mp.votesMtx.Lock()
err := mp.insertVote(tx)
mp.votesMtx.Unlock()
if err != nil {
return nil, err
}