mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-13 00:47:05 +02:00
test: pep-8 p2p_getdata.py
This commit is contained in:
@ -16,8 +16,8 @@ from test_framework.mininode import (
|
|||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import wait_until
|
from test_framework.util import wait_until
|
||||||
|
|
||||||
class P2PStoreBlock(P2PInterface):
|
|
||||||
|
|
||||||
|
class P2PStoreBlock(P2PInterface):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.blocks = defaultdict(int)
|
self.blocks = defaultdict(int)
|
||||||
@ -26,6 +26,7 @@ class P2PStoreBlock(P2PInterface):
|
|||||||
message.block.calc_sha256()
|
message.block.calc_sha256()
|
||||||
self.blocks[message.block.sha256] += 1
|
self.blocks[message.block.sha256] += 1
|
||||||
|
|
||||||
|
|
||||||
class GetdataTest(BitcoinTestFramework):
|
class GetdataTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
@ -47,5 +48,6 @@ class GetdataTest(BitcoinTestFramework):
|
|||||||
self.nodes[0].p2ps[0].send_and_ping(good_getdata)
|
self.nodes[0].p2ps[0].send_and_ping(good_getdata)
|
||||||
wait_until(lambda: self.nodes[0].p2ps[0].blocks[best_block] == 1, timeout=30, lock=mininode_lock)
|
wait_until(lambda: self.nodes[0].p2ps[0].blocks[best_block] == 1, timeout=30, lock=mininode_lock)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
GetdataTest().main()
|
GetdataTest().main()
|
||||||
|
Reference in New Issue
Block a user