Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_assumevalid.py
Show All 27 Lines | Start three nodes: | ||||
- node2 has -assumevalid set to the hash of block 102. Try to sync to | - node2 has -assumevalid set to the hash of block 102. Try to sync to | ||||
block 200. node2 will reject block 102 since it's assumed valid, but it | block 200. node2 will reject block 102 since it's assumed valid, but it | ||||
isn't buried by at least two weeks' work. | isn't buried by at least two weeks' work. | ||||
""" | """ | ||||
import time | import time | ||||
from test_framework.blocktools import (create_block, create_coinbase) | from test_framework.blocktools import (create_block, create_coinbase) | ||||
from test_framework.key import CECKey | from test_framework.key import CECKey | ||||
from test_framework.mininode import (CBlockHeader, | from test_framework.messages import ( | ||||
CBlockHeader, | |||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
msg_block, | |||||
msg_headers, | |||||
) | |||||
from test_framework.mininode import ( | |||||
network_thread_join, | network_thread_join, | ||||
network_thread_start, | network_thread_start, | ||||
P2PInterface, | P2PInterface, | ||||
msg_block, | ) | ||||
msg_headers) | |||||
from test_framework.script import (CScript, OP_TRUE) | from test_framework.script import (CScript, OP_TRUE) | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal | |||||
from test_framework.txtools import pad_tx | from test_framework.txtools import pad_tx | ||||
from test_framework.util import assert_equal | |||||
class BaseNode(P2PInterface): | class BaseNode(P2PInterface): | ||||
def send_header_for_blocks(self, new_blocks): | def send_header_for_blocks(self, new_blocks): | ||||
headers_message = msg_headers() | headers_message = msg_headers() | ||||
headers_message.headers = [CBlockHeader(b) for b in new_blocks] | headers_message.headers = [CBlockHeader(b) for b in new_blocks] | ||||
self.send_message(headers_message) | self.send_message(headers_message) | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |