MCPcopy Create free account
hub / github.com/ElementsProject/lightning / mock_getblock

Function mock_getblock

tests/test_misc.py:172–188  ·  view source on GitHub ↗
(r)

Source from the content-addressed store, hash-verified

170 fetched_peerblock = False
171
172 def mock_getblock(r):
173 # Simulate a pruned node that reutrns an error when asked for a block.
174 nonlocal fetched_peerblock
175 if fetched_peerblock:
176 fetched_peerblock = False
177 conf_file = os.path.join(bitcoind.bitcoin_dir, "bitcoin.conf")
178 brpc = RawProxy(btc_conf_file=conf_file)
179 return {
180 "result": brpc._call(r["method"], *r["params"]),
181 "error": None,
182 "id": r["id"],
183 }
184 return {
185 "id": r["id"],
186 "result": None,
187 "error": {"code": -1, "message": "Block not available (pruned data)"},
188 }
189
190 def mock_getpeerinfo(r, error=False):
191 if error:

Callers

nothing calls this directly

Calls 2

joinMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected