You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
498 B

  1. package mempool
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. "github.com/tendermint/tendermint/internal/p2p"
  6. )
  7. func TestMempoolIDsBasic(t *testing.T) {
  8. ids := NewMempoolIDs()
  9. peerID, err := p2p.NewNodeID("0011223344556677889900112233445566778899")
  10. require.NoError(t, err)
  11. ids.ReserveForPeer(peerID)
  12. require.EqualValues(t, 1, ids.GetForPeer(peerID))
  13. ids.Reclaim(peerID)
  14. ids.ReserveForPeer(peerID)
  15. require.EqualValues(t, 2, ids.GetForPeer(peerID))
  16. ids.Reclaim(peerID)
  17. }