aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/blocktools.py
diff options
context:
space:
mode:
authorGillian Chu <gillianchu@Gillians-MacBook-Pro.local>2020-05-27 10:05:34 -0700
committerGillian Chu <gillianchu@Gillians-MacBook-Pro.local>2020-06-03 07:18:01 -0700
commit7daffc6a90a797ce7c365a893a31a31b0206985c (patch)
treebc55218a6dc600efb769ebbe32b8d035b180d8c8 /test/functional/test_framework/blocktools.py
parent9bc7751cadbd038faf8ac1d62cda23fcf00d4cc2 (diff)
downloadbitcoin-7daffc6a90a797ce7c365a893a31a31b0206985c.tar.xz
[test] CScriptNum Decode Check as Unit Tests
Migrates the CScriptNum decode tests into a unit test, and moved some changes made in #14816. Made possible by the integration of test_framework unit testing in #18576. Further extends the original test with larger ints, similar to the scriptnum_tests.cpp file. Adds test to blocktools.py testing fn create_coinbase() with CScriptNum decode.
Diffstat (limited to 'test/functional/test_framework/blocktools.py')
-rw-r--r--test/functional/test_framework/blocktools.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py
index d741b00ba0..afc1995009 100644
--- a/test/functional/test_framework/blocktools.py
+++ b/test/functional/test_framework/blocktools.py
@@ -4,6 +4,8 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
+import unittest
+
from .address import (
key_to_p2sh_p2wpkh,
key_to_p2wpkh,
@@ -217,3 +219,9 @@ def send_to_witness(use_p2wsh, node, utxo, pubkey, encode_p2sh, amount, sign=Tru
tx_to_witness = ToHex(tx)
return node.sendrawtransaction(tx_to_witness)
+
+class TestFrameworkBlockTools(unittest.TestCase):
+ def test_create_coinbase(self):
+ height = 20
+ coinbase_tx = create_coinbase(height=height)
+ assert_equal(CScriptNum.decode(coinbase_tx.vin[0].scriptSig), height)