rpc/test: wait for mempool CheckTx callback (#4908)
Fixes race conditions causing the following test failures:
```
=== RUN TestUnconfirmedTxs
TestUnconfirmedTxs: rpc_test.go:342:
Error Trace: rpc_test.go:342
Error: Not equal:
expected: 1
actual : 0
Test: TestUnconfirmedTxs
TestUnconfirmedTxs: rpc_test.go:343:
Error Trace: rpc_test.go:343
Error: Not equal:
expected: 1
actual : 0
Test: TestUnconfirmedTxs
TestUnconfirmedTxs: rpc_test.go:345:
Error Trace: rpc_test.go:345
Error: Not equal:
expected: types.Txs{types.Tx{0x39, 0x44, 0x4d, 0x6c, 0x4b, 0x66, 0x46, 0x78, 0x3d, 0x45, 0x33, 0x33, 0x68, 0x47, 0x6e, 0x79, 0x58}}
actual : types.Txs(nil)
Diff:
--- Expected
+++ Actual
@@ -1,4 +1,2 @@
-(types.Txs) (len=1) {
- (types.Tx) (len=17) Tx{39444D6C4B6646783D45333368476E7958}
-}
+(types.Txs) <nil>
Test: TestUnconfirmedTxs
TestUnconfirmedTxs: rpc_test.go:342:
Error Trace: rpc_test.go:342
Error: Not equal:
expected: 1
actual : 0
Test: TestUnconfirmedTxs
TestUnconfirmedTxs: rpc_test.go:343:
Error Trace: rpc_test.go:343
Error: Not equal:
expected: 1
actual : 0
Test: TestUnconfirmedTxs
TestUnconfirmedTxs: rpc_test.go:345:
Error Trace: rpc_test.go:345
Error: Not equal:
expected: types.Txs{types.Tx{0x39, 0x44, 0x4d, 0x6c, 0x4b, 0x66, 0x46, 0x78, 0x3d, 0x45, 0x33, 0x33, 0x68, 0x47, 0x6e, 0x79, 0x58}}
actual : types.Txs{}
Diff:
--- Expected
+++ Actual
@@ -1,3 +1,2 @@
-(types.Txs) (len=1) {
- (types.Tx) (len=17) Tx{39444D6C4B6646783D45333368476E7958}
+(types.Txs) {
}
Test: TestUnconfirmedTxs
--- FAIL: TestUnconfirmedTxs (0.20s)
=== RUN TestNumUnconfirmedTxs
TestNumUnconfirmedTxs: rpc_test.go:364:
Error Trace: rpc_test.go:364
Error: Not equal:
expected: 1
actual : 0
Test: TestNumUnconfirmedTxs
TestNumUnconfirmedTxs: rpc_test.go:365:
Error Trace: rpc_test.go:365
Error: Not equal:
expected: 1
actual : 0
Test: TestNumUnconfirmedTxs
TestNumUnconfirmedTxs: rpc_test.go:364:
Error Trace: rpc_test.go:364
Error: Not equal:
expected: 1
actual : 0
Test: TestNumUnconfirmedTxs
TestNumUnconfirmedTxs: rpc_test.go:365:
Error Trace: rpc_test.go:365
Error: Not equal:
expected: 1
actual : 0
Test: TestNumUnconfirmedTxs
--- FAIL: TestNumUnconfirmedTxs (0.09s)
```