Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_bip68_sequence.py
Show All 23 Lines | |||||
from test_framework.txtools import pad_tx | from test_framework.txtools import pad_tx | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
assert_greater_than, | assert_greater_than, | ||||
assert_raises_rpc_error, | assert_raises_rpc_error, | ||||
connect_nodes, | connect_nodes, | ||||
disconnect_nodes, | disconnect_nodes, | ||||
satoshi_round, | satoshi_round, | ||||
sync_blocks, | |||||
) | ) | ||||
SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31) | SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31) | ||||
# this means use time (0 means height) | # this means use time (0 means height) | ||||
SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22) | SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22) | ||||
# this is a bit-shift | # this is a bit-shift | ||||
SEQUENCE_LOCKTIME_GRANULARITY = 9 | SEQUENCE_LOCKTIME_GRANULARITY = 9 | ||||
SEQUENCE_LOCKTIME_MASK = 0x0000ffff | SEQUENCE_LOCKTIME_MASK = 0x0000ffff | ||||
▲ Show 20 Lines • Show All 429 Lines • ▼ Show 20 Lines | def activateCSV(self): | ||||
assert_equal(self.get_csv_status(), False) | assert_equal(self.get_csv_status(), False) | ||||
disconnect_nodes(self.nodes[0], self.nodes[1]) | disconnect_nodes(self.nodes[0], self.nodes[1]) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
assert_equal(self.get_csv_status(), True) | assert_equal(self.get_csv_status(), True) | ||||
# We have a block that has CSV activated, but we want to be at | # We have a block that has CSV activated, but we want to be at | ||||
# the activation point, so we invalidate the tip. | # the activation point, so we invalidate the tip. | ||||
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash()) | self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash()) | ||||
connect_nodes(self.nodes[0], self.nodes[1]) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
sync_blocks(self.nodes) | self.sync_blocks() | ||||
# Use self.nodes[1] to test that version 2 transactions are standard. | # Use self.nodes[1] to test that version 2 transactions are standard. | ||||
def test_version2_relay(self): | def test_version2_relay(self): | ||||
inputs = [] | inputs = [] | ||||
outputs = {self.nodes[1].getnewaddress(): 1.0} | outputs = {self.nodes[1].getnewaddress(): 1.0} | ||||
rawtx = self.nodes[1].createrawtransaction(inputs, outputs) | rawtx = self.nodes[1].createrawtransaction(inputs, outputs) | ||||
rawtxfund = self.nodes[1].fundrawtransaction(rawtx)['hex'] | rawtxfund = self.nodes[1].fundrawtransaction(rawtx)['hex'] | ||||
tx = FromHex(CTransaction(), rawtxfund) | tx = FromHex(CTransaction(), rawtxfund) | ||||
tx.nVersion = 2 | tx.nVersion = 2 | ||||
tx_signed = self.nodes[1].signrawtransactionwithwallet(ToHex(tx))[ | tx_signed = self.nodes[1].signrawtransactionwithwallet(ToHex(tx))[ | ||||
"hex"] | "hex"] | ||||
self.nodes[1].sendrawtransaction(tx_signed) | self.nodes[1].sendrawtransaction(tx_signed) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
BIP68Test().main() | BIP68Test().main() |