aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2020-08-22 18:51:45 +0200
committerFabian Jahr <fjahr@protonmail.com>2021-04-19 20:31:02 +0200
commite0938c29099635150014ffc9bb0cafa8049ec55a (patch)
tree68d6b5f486e196017b8f04f5ac729df1b68ad2b1 /test/functional/test_framework
parent2501576eccb08af80471c7b7b843b189ad6758c0 (diff)
downloadbitcoin-e0938c29099635150014ffc9bb0cafa8049ec55a.tar.xz
test: Add tests for block_info in gettxoutsetinfo
This additional data will automatically be returned if the coinstats index is used.
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/blocktools.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py
index e691b63df6..d08e025178 100644
--- a/test/functional/test_framework/blocktools.py
+++ b/test/functional/test_framework/blocktools.py
@@ -115,7 +115,7 @@ def script_BIP34_coinbase_height(height):
return CScript([CScriptNum(height)])
-def create_coinbase(height, pubkey=None, extra_output_script=None, fees=0):
+def create_coinbase(height, pubkey=None, extra_output_script=None, fees=0, nValue=50):
"""Create a coinbase transaction.
If pubkey is passed in, the coinbase output will be a P2PK output;
@@ -126,10 +126,11 @@ def create_coinbase(height, pubkey=None, extra_output_script=None, fees=0):
coinbase = CTransaction()
coinbase.vin.append(CTxIn(COutPoint(0, 0xffffffff), script_BIP34_coinbase_height(height), 0xffffffff))
coinbaseoutput = CTxOut()
- coinbaseoutput.nValue = 50 * COIN
- halvings = int(height / 150) # regtest
- coinbaseoutput.nValue >>= halvings
- coinbaseoutput.nValue += fees
+ coinbaseoutput.nValue = nValue * COIN
+ if nValue == 50:
+ halvings = int(height / 150) # regtest
+ coinbaseoutput.nValue >>= halvings
+ coinbaseoutput.nValue += fees
if pubkey is not None:
coinbaseoutput.scriptPubKey = CScript([pubkey, OP_CHECKSIG])
else: