Skip to content

Commit 6a49173

Browse files
authored
Merge branch 'master' into make_elastic_docker
2 parents 7cc8712 + 6258651 commit 6a49173

File tree

9 files changed

+51
-22
lines changed

9 files changed

+51
-22
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55

66
lint:
77
name: lint
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-20.04
99
steps:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-python@v1
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
matrix:
2828
os:
29-
- ubuntu-latest
29+
- ubuntu-20.04
3030
- macos-latest
3131
- windows-latest
3232
runs-on: ${{ matrix.os }}
@@ -72,7 +72,7 @@ jobs:
7272
7373
tests-integration:
7474
name: "tests / integration"
75-
runs-on: ubuntu-latest
75+
runs-on: ubuntu-20.04
7676
strategy:
7777
matrix:
7878
test:
@@ -123,7 +123,7 @@ jobs:
123123
124124
coverage:
125125
needs: ["tests-unit", "tests-integration"]
126-
runs-on: ubuntu-latest
126+
runs-on: ubuntu-20.04
127127
steps:
128128
- name: finalize coverage report submission
129129
env:
@@ -160,7 +160,7 @@ jobs:
160160
path: ${{ steps.pip-cache.outputs.dir }}
161161
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
162162
restore-keys: ${{ runner.os }}-pip-
163-
- run: pip install pyinstaller==4.4
163+
- run: pip install pyinstaller==4.6
164164
- run: pip install -e .
165165
- if: startsWith(github.ref, 'refs/tags/v')
166166
run: python docker/set_build.py
@@ -184,7 +184,7 @@ jobs:
184184
name: "release"
185185
if: startsWith(github.ref, 'refs/tags/v')
186186
needs: ["build"]
187-
runs-on: ubuntu-latest
187+
runs-on: ubuntu-20.04
188188
steps:
189189
- uses: actions/checkout@v1
190190
- uses: actions/download-artifact@v2

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
release:
99
name: "slack notification"
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-20.04
1111
steps:
1212
- uses: LoveToKnow/[email protected]
1313
id: markdown

lbry/dht/protocol/routing_table.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from lbry import utils
1010
from lbry.dht import constants
11+
from lbry.dht.error import RemoteException
1112
from lbry.dht.protocol.distance import Distance
1213
if typing.TYPE_CHECKING:
1314
from lbry.dht.peer import KademliaPeer, PeerManager
@@ -395,7 +396,7 @@ async def add_peer(self, peer: 'KademliaPeer', probe: typing.Callable[['Kademlia
395396
try:
396397
await probe(to_replace)
397398
return False
398-
except asyncio.TimeoutError:
399+
except (asyncio.TimeoutError, RemoteException):
399400
log.debug("Replacing dead contact in bucket %i: %s:%i with %s:%i ", bucket_index,
400401
to_replace.address, to_replace.udp_port, peer.address, peer.udp_port)
401402
if to_replace in self.buckets[bucket_index]:

lbry/wallet/orchstr8/node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def __init__(self, node_number=1):
214214
self.port = 50001 + node_number # avoid conflict with default daemon
215215
self.udp_port = self.port
216216
self.elastic_notifier_port = 19080 + node_number
217+
self.elastic_services = f'localhost:9200/localhost:{self.elastic_notifier_port}'
217218
self.session_timeout = 600
218219
self.stopped = True
219220
self.index_name = uuid4().hex
@@ -235,7 +236,7 @@ async def start(self, lbcwallet_node: 'LBCWalletNode', extraconf=None):
235236
'host': self.hostname,
236237
'tcp_port': self.port,
237238
'udp_port': self.udp_port,
238-
'elastic_notifier_port': self.elastic_notifier_port,
239+
'elastic_services': self.elastic_services,
239240
'session_timeout': self.session_timeout,
240241
'max_query_workers': 0,
241242
'es_index_prefix': self.index_name,

lbry/wallet/wallet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ def unpack(cls, password, encrypted):
182182
raise InvalidPasswordError()
183183
if "unknown compression method" in e.args[0].lower():
184184
raise InvalidPasswordError()
185+
if "invalid window size" in e.args[0].lower():
186+
raise InvalidPasswordError()
185187
raise
186188
return json.loads(decompressed)
187189

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'jsonschema==4.4.0',
5858
],
5959
'hub': [
60-
'hub@git+https://github.com/lbryio/hub.git@024aceda53fe6d1ab8d519b73584437c25de6975'
60+
'hub@git+https://github.com/lbryio/hub.git@929448d64bcbe6c5e476757ec78456beaa85e56a'
6161
]
6262
},
6363
classifiers=[

tests/integration/takeovers/test_resolve_command.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,27 +1508,27 @@ async def get_trending_score(claim_id):
15081508
COIN = int(1E8)
15091509

15101510
self.assertEqual(self.conductor.spv_node.writer.height, 207)
1511-
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put(
1511+
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put(
15121512
(208, bytes.fromhex(claim_id1)), (0, 10 * COIN)
15131513
)
15141514
await self.generate(1)
15151515
self.assertEqual(self.conductor.spv_node.writer.height, 208)
15161516

15171517
self.assertEqual(1.7090807854206793, await get_trending_score(claim_id1))
1518-
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put(
1518+
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put(
15191519
(209, bytes.fromhex(claim_id1)), (10 * COIN, 100 * COIN)
15201520
)
15211521
await self.generate(1)
15221522
self.assertEqual(self.conductor.spv_node.writer.height, 209)
15231523
self.assertEqual(2.2437974397778886, await get_trending_score(claim_id1))
1524-
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put(
1524+
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put(
15251525
(309, bytes.fromhex(claim_id1)), (100 * COIN, 1000000 * COIN)
15261526
)
15271527
await self.generate(100)
15281528
self.assertEqual(self.conductor.spv_node.writer.height, 309)
15291529
self.assertEqual(5.157053472135866, await get_trending_score(claim_id1))
15301530

1531-
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put(
1531+
self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put(
15321532
(409, bytes.fromhex(claim_id1)), (1000000 * COIN, 1 * COIN)
15331533
)
15341534

tests/integration/transactions/test_transaction_commands.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import unittest
33

44
from lbry.testcase import CommandTestCase
5-
5+
from lbry.wallet import Transaction
66

77
class TransactionCommandsTestCase(CommandTestCase):
88

@@ -29,17 +29,42 @@ async def test_transaction_show(self):
2929
# someone's tx
3030
change_address = await self.blockchain.get_raw_change_address()
3131
sendtxid = await self.blockchain.send_to_address(change_address, 10)
32-
await asyncio.sleep(0.2)
33-
tx = await self.daemon.jsonrpc_transaction_show(sendtxid)
34-
self.assertEqual(tx.id, sendtxid)
35-
self.assertEqual(tx.height, -1)
32+
# After a few tries, Hub should have the transaction (in mempool).
33+
for i in range(5):
34+
tx = await self.daemon.jsonrpc_transaction_show(sendtxid)
35+
# Retry if Hub is not aware of the transaction.
36+
if isinstance(tx, dict):
37+
# Fields: 'success', 'code', 'message'
38+
self.assertFalse(tx['success'], tx)
39+
self.assertEqual(tx['code'], 404, tx)
40+
self.assertEqual(tx['message'], "transaction not found", tx)
41+
await asyncio.sleep(0.1)
42+
continue
43+
break
44+
# verify transaction show (in mempool)
45+
self.assertTrue(isinstance(tx, Transaction), str(tx))
46+
# Fields: 'txid', 'raw', 'height', 'position', 'is_verified', and more.
47+
self.assertEqual(tx.id, sendtxid, vars(tx))
48+
self.assertEqual(tx.height, -1, vars(tx))
49+
self.assertEqual(tx.is_verified, False, vars(tx))
50+
51+
# transaction is confirmed and leaves mempool
3652
await self.generate(1)
53+
54+
# verify transaction show
3755
tx = await self.daemon.jsonrpc_transaction_show(sendtxid)
38-
self.assertEqual(tx.height, self.ledger.headers.height)
56+
self.assertTrue(isinstance(tx, Transaction), str(tx))
57+
self.assertEqual(tx.id, sendtxid, vars(tx))
58+
self.assertEqual(tx.height, self.ledger.headers.height, vars(tx))
59+
self.assertEqual(tx.is_verified, True, vars(tx))
3960

4061
# inexistent
4162
result = await self.daemon.jsonrpc_transaction_show('0'*64)
42-
self.assertFalse(result['success'])
63+
self.assertTrue(isinstance(result, dict), result)
64+
# Fields: 'success', 'code', 'message'
65+
self.assertFalse(result['success'], result)
66+
self.assertEqual(result['code'], 404, result)
67+
self.assertEqual(result['message'], "transaction not found", result)
4368

4469
async def test_utxo_release(self):
4570
await self.send_to_address_and_wait(

tests/unit/wallet/test_database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ async def test_reset_on_version_change(self):
470470

471471

472472
class TestSQLiteRace(AsyncioTestCase):
473-
max_misuse_attempts = 80000
473+
max_misuse_attempts = 120000
474474

475475
def setup_db(self):
476476
self.db = sqlite3.connect(":memory:", isolation_level=None)

0 commit comments

Comments
 (0)