Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_csv_activation.py
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
import time | import time | ||||
from test_framework.blocktools import ( | from test_framework.blocktools import ( | ||||
create_block, | create_block, | ||||
create_coinbase, | create_coinbase, | ||||
make_conform_to_ctor, | make_conform_to_ctor, | ||||
) | ) | ||||
from test_framework.messages import COIN, CTransaction, FromHex, ToHex | from test_framework.messages import COIN, CTransaction, FromHex, ToHex | ||||
from test_framework.mininode import network_thread_start, P2PDataStore | from test_framework.mininode import P2PDataStore | ||||
from test_framework.script import ( | from test_framework.script import ( | ||||
CScript, | CScript, | ||||
OP_CHECKSEQUENCEVERIFY, | OP_CHECKSEQUENCEVERIFY, | ||||
OP_DROP, | OP_DROP, | ||||
OP_TRUE, | OP_TRUE, | ||||
) | ) | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.txtools import pad_tx | from test_framework.txtools import pad_tx | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | def sync_blocks(self, blocks, success=True): | ||||
"""Sends blocks to test node. Syncs and verifies that tip has advanced to most recent block. | """Sends blocks to test node. Syncs and verifies that tip has advanced to most recent block. | ||||
Call with success = False if the tip shouldn't advance to the most recent block.""" | Call with success = False if the tip shouldn't advance to the most recent block.""" | ||||
self.nodes[0].p2p.send_blocks_and_test( | self.nodes[0].p2p.send_blocks_and_test( | ||||
blocks, self.nodes[0], success=success) | blocks, self.nodes[0], success=success) | ||||
def run_test(self): | def run_test(self): | ||||
self.nodes[0].add_p2p_connection(P2PDataStore()) | self.nodes[0].add_p2p_connection(P2PDataStore()) | ||||
network_thread_start() | |||||
self.nodes[0].p2p.wait_for_verack() | self.nodes[0].p2p.wait_for_verack() | ||||
self.log.info("Generate blocks in the past for coinbase outputs.") | self.log.info("Generate blocks in the past for coinbase outputs.") | ||||
# Enough to build up to 1000 blocks 10 minutes apart without worrying | # Enough to build up to 1000 blocks 10 minutes apart without worrying | ||||
# about getting into the future | # about getting into the future | ||||
long_past_time = int(time.time()) - 600 * 1000 | long_past_time = int(time.time()) - 600 * 1000 | ||||
# Enough so that the generated blocks will still all be before long_past_time | # Enough so that the generated blocks will still all be before long_past_time | ||||
self.nodes[0].setmocktime(long_past_time - 100) | self.nodes[0].setmocktime(long_past_time - 100) | ||||
▲ Show 20 Lines • Show All 428 Lines • Show Last 20 Lines |