mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
feature_fedpeg.py: Run in various dynafed transition settings
This commit is contained in:
parent
feef196a20
commit
b105ff45e5
3 changed files with 27 additions and 1 deletions
|
|
@ -1007,7 +1007,7 @@ UniValue getnewblockhex(const JSONRPCRequest& request)
|
|||
{
|
||||
{"signblockscript", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Hex-encoded block signing script to propose"},
|
||||
{"max_block_witness", RPCArg::Type::NUM, RPCArg::Optional::NO, "Total size in witness bytes that are allowed in the dynamic federations block witness for blocksigning"},
|
||||
{"fedpegscript", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Hex-encoded fedpegscript for dynamic block proposal"},
|
||||
{"fedpegscript", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Hex-encoded fedpegscript for dynamic block proposal. This is interpreted as a v0 segwit witnessScript, and fills out the fedpeg_program as such."},
|
||||
{"extension_space", RPCArg::Type::ARR, RPCArg::Optional::NO, "Array of additional fields to embed in the dynamic blockheader. Has no consensus meaning aside from serialized size changes. This space is currently is only used for PAK enforcement.",
|
||||
{
|
||||
{"", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Hex encoded string for extension entries."},
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ class FedPegTest(BitcoinTestFramework):
|
|||
help="Use a different binary for launching nodes")
|
||||
parser.add_argument("--parent_bitcoin", dest="parent_bitcoin", default=False, action="store_true",
|
||||
help="Parent nodes are Bitcoin")
|
||||
parser.add_argument("--pre_transition", dest="pre_transition", default=False, action="store_true",
|
||||
help="Run test in dynafed activated chain, without a transition")
|
||||
parser.add_argument("--post_transition", dest="post_transition", default=False, action="store_true",
|
||||
help="Run test in dynafed activated chain, after transition and additional epoch to invalidate old fedpegscript")
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
|
@ -134,6 +138,10 @@ class FedPegTest(BitcoinTestFramework):
|
|||
'-con_parent_pegged_asset=%s' % parent_pegged_asset,
|
||||
])
|
||||
|
||||
# Immediate activation of dynafed when requested versus "never" from conf
|
||||
if self.options.pre_transition or self.options.post_transition:
|
||||
extra_args.extend(["-con_dyna_deploy_start=-1"])
|
||||
|
||||
# Use rpcuser auth only for first parent.
|
||||
if n==0:
|
||||
# Extract username and password from cookie file and use directly.
|
||||
|
|
@ -182,6 +190,22 @@ class FedPegTest(BitcoinTestFramework):
|
|||
#parent2 = self.nodes[1]
|
||||
sidechain = self.nodes[2]
|
||||
sidechain2 = self.nodes[3]
|
||||
|
||||
# If we're testing post-transition, force a fedpegscript transition and
|
||||
# getting rid of old fedpegscript by making at least another epoch pass by
|
||||
WSH_OP_TRUE = self.nodes[0].decodescript("51")["segwit"]["hex"]
|
||||
# We just randomize the keys a bit to get another valid fedpegscript
|
||||
new_fedpegscript = sidechain.tweakfedpegscript("f00dbabe")["script"]
|
||||
if self.options.post_transition:
|
||||
print("Running test post-transition")
|
||||
for _ in range(30):
|
||||
block_hex = sidechain.getnewblockhex(0, {"signblockscript":WSH_OP_TRUE, "max_block_witness":10, "fedpegscript":new_fedpegscript, "extension_space":[]})
|
||||
sidechain.submitblock(block_hex)
|
||||
assert_equal(sidechain.getsidechaininfo()["current_fedpegscripts"], [new_fedpegscript]*2)
|
||||
|
||||
if self.options.pre_transition:
|
||||
print("Running test pre-transition, dynafed activated from first block")
|
||||
|
||||
for node in self.nodes:
|
||||
node.importprivkey(privkey=node.get_deterministic_priv_key().key, label="mining")
|
||||
util.node_fastmerkle = sidechain
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ BASE_SCRIPTS = [
|
|||
# Scripts that are run by the travis build process.
|
||||
# vv First elements tests vv
|
||||
'feature_fedpeg.py',
|
||||
'feature_fedpeg.py --pre_transition',
|
||||
'feature_fedpeg.py --post_transition',
|
||||
'feature_mandatory_coinbase.py',
|
||||
'feature_block_subsidy.py',
|
||||
'feature_connect_genesis_outputs.py',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue