Skip to content

Commit 1664632

Browse files
committed
Adds creditpool data to coinbase tx python's binding (message.py)
It also fixes functional tests 'feature_nulldummy.py', 'feature_llmq_is_cl_conflicts.py'
1 parent a3a10a2 commit 1664632

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

test/functional/feature_nulldummy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from test_framework.messages import CTransaction
1818
from test_framework.script import CScript
1919
from test_framework.test_framework import BitcoinTestFramework
20-
from test_framework.util import assert_equal, assert_raises_rpc_error
20+
from test_framework.util import assert_equal, assert_raises_rpc_error, get_bip9_status
2121

2222

2323
NULLDUMMY_ERROR = "non-mandatory-script-verify-flag (Dummy CHECKMULTISIG argument must be zero) (code 64)"
@@ -88,7 +88,11 @@ def run_test(self):
8888

8989
def block_submit(self, node, txs, accept = False):
9090
dip4_activated = self.lastblockheight + 1 >= 432
91-
block = create_block(self.tip, create_coinbase(self.lastblockheight + 1, dip4_activated=dip4_activated), self.lastblocktime + 1)
91+
print("bip9")
92+
info = node.getblockchaininfo()
93+
print(info['bip9_softforks'])
94+
dip27_activated = get_bip9_status(self.nodes[0], 'dip0027-asset-locks')['status'] == 'active'
95+
block = create_block(self.tip, create_coinbase(self.lastblockheight + 1, dip4_activated=dip4_activated, dip27_activated=dip27_activated), self.lastblocktime + 1)
9296
block.nVersion = 4
9397
for tx in txs:
9498
tx.rehash()

test/functional/test_framework/blocktools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def script_BIP34_coinbase_height(height):
4646
return CScript([CScriptNum(height)])
4747

4848

49-
def create_coinbase(height, pubkey=None, dip4_activated=False):
49+
def create_coinbase(height, pubkey=None, dip4_activated=False, dip27_activated=False):
5050
"""Create a coinbase transaction, assuming no miner fees.
5151
5252
If pubkey is passed in, the coinbase output will be a P2PK output;
@@ -65,7 +65,8 @@ def create_coinbase(height, pubkey=None, dip4_activated=False):
6565
if dip4_activated:
6666
coinbase.nVersion = 3
6767
coinbase.nType = 5
68-
cbtx_payload = CCbTx(2, height, 0, 0)
68+
cbtx_version = 3 if dip27_activated else 2
69+
cbtx_payload = CCbTx(cbtx_version, height, 0, 0, 0)
6970
coinbase.vExtraPayload = cbtx_payload.serialize()
7071
coinbase.calc_sha256()
7172
return coinbase

test/functional/test_framework/messages.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ def __repr__(self):
10341034

10351035

10361036
class CCbTx:
1037-
__slots__ = ("version", "height", "merkleRootMNList", "merkleRootQuorums")
1037+
__slots__ = ("version", "height", "merkleRootMNList", "merkleRootQuorums", "lockedAmount")
10381038

1039-
def __init__(self, version=None, height=None, merkleRootMNList=None, merkleRootQuorums=None):
1039+
def __init__(self, version=None, height=None, merkleRootMNList=None, merkleRootQuorums=None, lockedAmount=None):
10401040
self.set_null()
10411041
if version is not None:
10421042
self.version = version
@@ -1046,18 +1046,23 @@ def __init__(self, version=None, height=None, merkleRootMNList=None, merkleRootQ
10461046
self.merkleRootMNList = merkleRootMNList
10471047
if merkleRootQuorums is not None:
10481048
self.merkleRootQuorums = merkleRootQuorums
1049+
if lockedAmount is not None:
1050+
self.lockedAmount = lockedAmount
10491051

10501052
def set_null(self):
10511053
self.version = 0
10521054
self.height = 0
10531055
self.merkleRootMNList = None
1056+
self.lockedAmount = 0
10541057

10551058
def deserialize(self, f):
10561059
self.version = struct.unpack("<H", f.read(2))[0]
10571060
self.height = struct.unpack("<i", f.read(4))[0]
10581061
self.merkleRootMNList = deser_uint256(f)
10591062
if self.version >= 2:
10601063
self.merkleRootQuorums = deser_uint256(f)
1064+
if self.version >= 3:
1065+
self.lockedAmount = struct.unpack("<q", f.read(8))[0]
10611066

10621067
def serialize(self):
10631068
r = b""
@@ -1066,6 +1071,8 @@ def serialize(self):
10661071
r += ser_uint256(self.merkleRootMNList)
10671072
if self.version >= 2:
10681073
r += ser_uint256(self.merkleRootQuorums)
1074+
if self.version >= 3:
1075+
r += struct.pack("<q", self.lockedAmount)
10691076
return r
10701077

10711078

0 commit comments

Comments
 (0)