| 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: |