Skip to content

Commit 6051fcf

Browse files
committed
fix blocks pulling
1 parent 55e0e44 commit 6051fcf

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"rpc": {
3-
"host": "",
4-
"port": 0,
5-
"user": "",
6-
"password": ""
3+
"host": "http://192.168.1.59",
4+
"port": 8332,
5+
"user": "bitcoin",
6+
"password": "ilovebitcoin"
77
},
88
"blocks": {
9-
"count": 900001
9+
"count": 918000
1010
},
1111
"from_checkpoint": false
1212
}

src/bitcoin-prover/generators/blocks/main.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,21 @@ def main():
110110
blocks = loaded.blocks
111111
else:
112112
puller = BlockHeaderPuller(config["rpc"])
113+
end = False
113114
for i in range(loaded.amount, config["blocks"]["count"], 2000):
114115
hex_headers = puller.pull_block_headers(
115116
i, min(2000, config["blocks"]["count"] - i))
117+
118+
if any(h is None for h in hex_headers):
119+
end = True
120+
121+
hex_headers = [h for h in hex_headers if h is not None]
122+
116123
blocks = [Block(header) for header in hex_headers]
117124
loaded.add_blocks(blocks)
118-
125+
if end:
126+
break
127+
119128
blocks = loaded.blocks
120129

121130
if not checkpoint:

src/bitcoin-prover/scripts/blocks.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,5 @@ set -e
77
mkdir -p ./target/blocks_bin
88
mkdir -p ./target/blocks_bin/recursive
99

10-
if ! pip show electrum_client >/dev/null 2>&1; then
11-
echo -e "Pakage 'electrum_client' is not installed yet.\nRun:\n\tpip3 install electrum_client==0.0.1"
12-
exit 1
13-
fi
14-
1510
# Generate Prover.toml
1611
python3 -m generators.blocks.main "$@"

0 commit comments

Comments
 (0)