From c10c40779d9b73359ee61f85ec5f1bb88acac61d Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 4 Oct 2017 00:34:32 +0100 Subject: [PATCH] [Test] MiniNode: Implement Zcash coinbase --- qa/rpc-tests/test_framework/blocktools.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qa/rpc-tests/test_framework/blocktools.py b/qa/rpc-tests/test_framework/blocktools.py index ca566e4bc..1fe2a5dda 100644 --- a/qa/rpc-tests/test_framework/blocktools.py +++ b/qa/rpc-tests/test_framework/blocktools.py @@ -5,7 +5,7 @@ # from mininode import CBlock, CTransaction, CTxIn, CTxOut, COutPoint -from script import CScript, OP_0 +from script import CScript, OP_0, OP_EQUAL, OP_HASH160 # Create a block (with regtest difficulty) def create_block(hashprev, coinbase, nTime=None, nBits=None): @@ -49,11 +49,21 @@ def create_coinbase(heightAdjust = 0): CScript([counter+heightAdjust, OP_0]), 0xffffffff)) counter += 1 coinbaseoutput = CTxOut() - coinbaseoutput.nValue = 50*100000000 + coinbaseoutput.nValue = int(12.5*100000000) halvings = int((counter+heightAdjust)/150) # regtest coinbaseoutput.nValue >>= halvings coinbaseoutput.scriptPubKey = "" coinbase.vout = [ coinbaseoutput ] + if halvings == 0: # regtest + froutput = CTxOut() + froutput.nValue = coinbaseoutput.nValue / 5 + # regtest + fraddr = bytearray([0x67, 0x08, 0xe6, 0x67, 0x0d, 0xb0, 0xb9, 0x50, + 0xda, 0xc6, 0x80, 0x31, 0x02, 0x5c, 0xc5, 0xb6, + 0x32, 0x13, 0xa4, 0x91]) + froutput.scriptPubKey = CScript([OP_HASH160, fraddr, OP_EQUAL]) + coinbaseoutput.nValue -= froutput.nValue + coinbase.vout = [ coinbaseoutput, froutput ] coinbase.calc_sha256() return coinbase