Ejemplo n.º 1
0
def test_squeak_matches_interest_is_not_reply(signing_key):
    replyto_hash = gen_random_hash()
    squeak = gen_squeak(signing_key, 5678, replyto_hash=replyto_hash)
    other_replyto_hash = gen_random_hash()
    interest = CInterested(hashReplySqk=other_replyto_hash, )

    assert not squeak_matches_interest(squeak, interest)
Ejemplo n.º 2
0
def test_squeak_matches_interest_empty_addresses(signing_key, address):
    squeak = gen_squeak(signing_key, 5678)
    interest = CInterested(
        nMinBlockHeight=5000,
        nMaxBlockHeight=6000,
    )

    assert squeak_matches_interest(squeak, interest)
Ejemplo n.º 3
0
def test_squeak_matches_interest_below_block_range(signing_key, address):
    squeak = gen_squeak(signing_key, 5678)
    interest = CInterested(
        addresses=(address, ),
        nMinBlockHeight=6000,
        nMaxBlockHeight=7000,
    )

    assert not squeak_matches_interest(squeak, interest)
Ejemplo n.º 4
0
def test_squeak_matches_interest_address_no_match(signing_key, address):
    squeak = gen_squeak(signing_key, 5678)
    other_addresses = tuple(gen_squeak_addresses(3))
    interest = CInterested(
        addresses=other_addresses,
        nMinBlockHeight=5000,
        nMaxBlockHeight=6000,
    )

    assert not squeak_matches_interest(squeak, interest)
Ejemplo n.º 5
0
def test_download_interest_is_not_interested(download_interest, signing_key,
                                             block_count):
    other_squeak = gen_squeak(signing_key, block_count + 200)
    downloaded_squeak = DownloadedSqueak(other_squeak)

    assert not download_interest.is_interested(downloaded_squeak)