func (m *mruInventoryMap) Add(iv *wire.InvVect) {
	m.invMtx.Lock()
	defer m.invMtx.Unlock()
	if m.limit == 0 {
		return
	}
	if node, exists := m.invMap[*iv]; exists {
		m.invList.MoveToFront(node)
		return
	}
	if uint(len(m.invMap))+1 > m.limit {
		node := m.invList.Back()
		lru := node.Value.(*wire.InvVect)
		delete(m.invMap, *lru)
		node.Value = iv
		m.invList.MoveToFront(node)
		m.invMap[*iv] = node
		return
	}
	node := m.invList.PushFront(iv)
	m.invMap[*iv] = node
	return
}
Add adds the passed inventory to the map and handles eviction of the oldest
item if adding the new item would exceed the max limit.  Adding an existing
item makes it the most recently used item.

This function is safe for concurrent access.
package peer
import (
	"bytes"
	"container/list"
	"fmt"
	"sync"
	"github.com/bitgo/prova/wire"
)
type mruInventoryMap struct {
	invMtx  sync.Mutex
	invMap  map[wire.InvVect]*list.Element  
	invList *list.List                      
	limit   uint
}
func (m *mruInventoryMap) String() string {
	m.invMtx.Lock()
	defer m.invMtx.Unlock()
	lastEntryNum := len(m.invMap) - 1
	curEntry := 0
	buf := bytes.NewBufferString("[")
	for iv := range m.invMap {
		buf.WriteString(fmt.Sprintf("%v", iv))
		if curEntry < lastEntryNum {
			buf.WriteString(", ")
		}
		curEntry++
	}
	buf.WriteString("]")
	return fmt.Sprintf("<%d>%s", m.limit, buf.String())
}
func (m *mruInventoryMap) Exists(iv *wire.InvVect) bool {
	m.invMtx.Lock()
	_, exists := m.invMap[*iv]
	m.invMtx.Unlock()
	return exists
}