diff --git a/tests/btcproxy.py b/tests/btcproxy.py index 9f7d3d348..8b0f64018 100644 --- a/tests/btcproxy.py +++ b/tests/btcproxy.py @@ -29,6 +29,7 @@ class BitcoinRpcProxy(object): self.app.add_url_rule("/", "API entrypoint", self.proxy, methods=['POST']) self.rpcport = rpcport self.mocks = {} + self.mock_counts = {} self.bitcoind = bitcoind self.request_count = 0 @@ -40,8 +41,10 @@ class BitcoinRpcProxy(object): # If we have set a mock for this method reply with that instead of # forwarding the request. if method in self.mocks and type(method) == dict: + self.mock_counts[method] += 1 return self.mocks[method] elif method in self.mocks and callable(self.mocks[method]): + self.mock_counts[method] += 1 return self.mocks[method](r) try: @@ -100,5 +103,6 @@ class BitcoinRpcProxy(object): """ if response is not None: self.mocks[method] = response + self.mock_counts[method] = 0 elif method in self.mocks: del self.mocks[method] diff --git a/tests/utils.py b/tests/utils.py index 565d306e6..7ec68a812 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -627,8 +627,10 @@ class LightningNode(object): } self.daemon.rpcproxy.mock_rpc('estimatesmartfee', mock_estimatesmartfee) + # Technically, this waits until it's called, not until it's processed. + # We wait until all three levels have been called. if wait_for_effect: - self.daemon.wait_for_log('Feerate estimate for .* set to') + wait_for(lambda: self.daemon.rpcproxy.mock_counts['estimatesmartfee'] >= 3) class NodeFactory(object):