Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_inv_download.py
Show First 20 Lines • Show All 384 Lines • ▼ Show 20 Lines | class InventoryDownloadTest(BitcoinTestFramework): | ||||
def test_orphan_download(self, context): | def test_orphan_download(self, context): | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
privkey = ECKey() | privkey = ECKey() | ||||
privkey.generate() | privkey.generate() | ||||
privkey_wif = bytes_to_wif(privkey.get_bytes()) | privkey_wif = bytes_to_wif(privkey.get_bytes()) | ||||
# Build a proof with missing utxos so it will be orphaned | # Build a proof with missing utxos so it will be orphaned | ||||
orphan = node.buildavalancheproof( | orphan = node.buildavalancheproof( | ||||
42, 2000000000, privkey.get_pubkey().get_bytes().hex(), [{ | 42, 2000000000, bytes_to_wif(privkey.get_bytes()), [{ | ||||
'txid': '0' * 64, | 'txid': '0' * 64, | ||||
'vout': 0, | 'vout': 0, | ||||
'amount': 10e6, | 'amount': 10e6, | ||||
'height': 42, | 'height': 42, | ||||
'iscoinbase': False, | 'iscoinbase': False, | ||||
'privatekey': privkey_wif, | 'privatekey': privkey_wif, | ||||
}] | }] | ||||
) | ) | ||||
Show All 20 Lines | class InventoryDownloadTest(BitcoinTestFramework): | ||||
@skip(TX_TEST_CONTEXT) | @skip(TX_TEST_CONTEXT) | ||||
def test_request_invalid_once(self, context): | def test_request_invalid_once(self, context): | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
privkey = ECKey() | privkey = ECKey() | ||||
privkey.generate() | privkey.generate() | ||||
# Build an invalid proof (no stake) | # Build an invalid proof (no stake) | ||||
no_stake_hex = node.buildavalancheproof( | no_stake_hex = node.buildavalancheproof( | ||||
42, 2000000000, privkey.get_pubkey().get_bytes().hex(), [] | 42, 2000000000, bytes_to_wif(privkey.get_bytes()), [] | ||||
) | ) | ||||
no_stake = FromHex(AvalancheProof(), no_stake_hex) | no_stake = FromHex(AvalancheProof(), no_stake_hex) | ||||
assert_raises_rpc_error(-8, | assert_raises_rpc_error(-8, | ||||
"The proof is invalid: no-stake", | "The proof is invalid: no-stake", | ||||
node.verifyavalancheproof, | node.verifyavalancheproof, | ||||
no_stake_hex) | no_stake_hex) | ||||
# Send the proof | # Send the proof | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |