|
|
@ -281,6 +281,42 @@ func TestBroadcastTxCommit(t *testing.T) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestUnconfirmedTxs(t *testing.T) { |
|
|
|
_, _, tx := MakeTxKV() |
|
|
|
|
|
|
|
mempool := node.MempoolReactor().Mempool |
|
|
|
_ = mempool.CheckTx(tx, nil) |
|
|
|
|
|
|
|
for i, c := range GetClients() { |
|
|
|
mc, ok := c.(client.MempoolClient) |
|
|
|
require.True(t, ok, "%d", i) |
|
|
|
txs, err := mc.UnconfirmedTxs(1) |
|
|
|
require.Nil(t, err, "%d: %+v", i, err) |
|
|
|
assert.Exactly(t, types.Txs{tx}, types.Txs(txs.Txs)) |
|
|
|
} |
|
|
|
|
|
|
|
mempool.Flush() |
|
|
|
} |
|
|
|
|
|
|
|
func TestNumUnconfirmedTxs(t *testing.T) { |
|
|
|
_, _, tx := MakeTxKV() |
|
|
|
|
|
|
|
mempool := node.MempoolReactor().Mempool |
|
|
|
_ = mempool.CheckTx(tx, nil) |
|
|
|
mempoolSize := mempool.Size() |
|
|
|
|
|
|
|
for i, c := range GetClients() { |
|
|
|
mc, ok := c.(client.MempoolClient) |
|
|
|
require.True(t, ok, "%d", i) |
|
|
|
res, err := mc.NumUnconfirmedTxs() |
|
|
|
require.Nil(t, err, "%d: %+v", i, err) |
|
|
|
|
|
|
|
assert.Equal(t, mempoolSize, res.N) |
|
|
|
} |
|
|
|
|
|
|
|
mempool.Flush() |
|
|
|
} |
|
|
|
|
|
|
|
func TestTx(t *testing.T) { |
|
|
|
// first we broadcast a tx
|
|
|
|
c := getHTTPClient() |
|
|
|