Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_proof_inventory.py
Show All 15 Lines | from test_framework.avatools import ( | ||||
get_proof_ids, | get_proof_ids, | ||||
wait_for_proof, | wait_for_proof, | ||||
) | ) | ||||
from test_framework.key import ECKey | from test_framework.key import ECKey | ||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
MSG_AVA_PROOF, | MSG_AVA_PROOF, | ||||
MSG_TYPE_MASK, | MSG_TYPE_MASK, | ||||
CInv, | CInv, | ||||
calculate_shortid, | |||||
msg_avaproof, | msg_avaproof, | ||||
msg_getavaproofs, | msg_getavaproofs, | ||||
msg_getdata, | msg_getdata, | ||||
) | ) | ||||
from test_framework.p2p import P2PInterface, p2p_lock | from test_framework.p2p import P2PInterface, p2p_lock | ||||
from test_framework.siphash import siphash256 | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal, assert_greater_than | from test_framework.util import assert_equal, assert_greater_than | ||||
from test_framework.wallet_util import bytes_to_wif | from test_framework.wallet_util import bytes_to_wif | ||||
# Broadcast reattempt occurs every 10 to 15 minutes | # Broadcast reattempt occurs every 10 to 15 minutes | ||||
MAX_INITIAL_BROADCAST_DELAY = 15 * 60 | MAX_INITIAL_BROADCAST_DELAY = 15 * 60 | ||||
# Delay to allow the node to respond to getdata requests | # Delay to allow the node to respond to getdata requests | ||||
UNCONDITIONAL_RELAY_DELAY = 2 * 60 | UNCONDITIONAL_RELAY_DELAY = 2 * 60 | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | def test_respond_getavaproofs(self): | ||||
proofids = get_proof_ids(node) | proofids = get_proof_ids(node) | ||||
assert_equal(len(proofids), 50) | assert_equal(len(proofids), 50) | ||||
receiving_peer = node.add_p2p_connection(AvaP2PInterface()) | receiving_peer = node.add_p2p_connection(AvaP2PInterface()) | ||||
send_getavaproof_check_shortid_len(receiving_peer, len(proofids)) | send_getavaproof_check_shortid_len(receiving_peer, len(proofids)) | ||||
avaproofs = received_avaproofs(receiving_peer) | avaproofs = received_avaproofs(receiving_peer) | ||||
expected_shortids = [ | expected_shortids = [ | ||||
siphash256( | calculate_shortid( | ||||
avaproofs.key0, | avaproofs.key0, | ||||
avaproofs.key1, | avaproofs.key1, | ||||
proofid) & 0x0000ffffffffffff for proofid in sorted(proofids)] | proofid) for proofid in sorted(proofids)] | ||||
assert_equal(expected_shortids, avaproofs.shortids) | assert_equal(expected_shortids, avaproofs.shortids) | ||||
# Don't expect any prefilled proof for now | # Don't expect any prefilled proof for now | ||||
assert_equal(len(avaproofs.prefilled_proofs), 0) | assert_equal(len(avaproofs.prefilled_proofs), 0) | ||||
def test_unbroadcast(self): | def test_unbroadcast(self): | ||||
self.log.info("Test broadcasting proofs") | self.log.info("Test broadcasting proofs") | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |