Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dersig.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2016 The Bitcoin Core developers | # Copyright (c) 2015-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test BIP66 (DER SIG). | """Test BIP66 (DER SIG). | ||||
Test that the DERSIG soft-fork activates at (regtest) height 1251. | Test that the DERSIG soft-fork activates at (regtest) height 1251. | ||||
""" | """ | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.mininode import * | from test_framework.mininode import * | ||||
from test_framework.blocktools import create_coinbase, create_block | from test_framework.blocktools import create_coinbase, create_block | ||||
from test_framework.script import CScript | from test_framework.script import CScript | ||||
from io import BytesIO | |||||
DERSIG_HEIGHT = 1251 | DERSIG_HEIGHT = 1251 | ||||
# Reject codes that we might receive in this test | # Reject codes that we might receive in this test | ||||
REJECT_INVALID = 16 | REJECT_INVALID = 16 | ||||
REJECT_OBSOLETE = 17 | REJECT_OBSOLETE = 17 | ||||
REJECT_NONSTANDARD = 64 | REJECT_NONSTANDARD = 64 | ||||
Show All 17 Lines | |||||
def create_transaction(node, coinbase, to_address, amount): | def create_transaction(node, coinbase, to_address, amount): | ||||
from_txid = node.getblock(coinbase)['tx'][0] | from_txid = node.getblock(coinbase)['tx'][0] | ||||
inputs = [{"txid": from_txid, "vout": 0}] | inputs = [{"txid": from_txid, "vout": 0}] | ||||
outputs = {to_address: amount} | outputs = {to_address: amount} | ||||
rawtx = node.createrawtransaction(inputs, outputs) | rawtx = node.createrawtransaction(inputs, outputs) | ||||
signresult = node.signrawtransaction(rawtx) | signresult = node.signrawtransaction(rawtx) | ||||
tx = CTransaction() | return FromHex(CTransaction(), signresult['hex']) | ||||
tx.deserialize(BytesIO(hex_str_to_bytes(signresult['hex']))) | |||||
return tx | |||||
class BIP66Test(BitcoinTestFramework): | class BIP66Test(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.extra_args = [ | self.extra_args = [ | ||||
['-promiscuousmempoolflags=1', '-whitelist=127.0.0.1']] | ['-promiscuousmempoolflags=1', '-whitelist=127.0.0.1']] | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |