mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Test listunspent sanity when specifying initialfreecoins
This commit is contained in:
parent
1ac14fc958
commit
95432aad58
1 changed files with 15 additions and 2 deletions
|
|
@ -4,15 +4,20 @@
|
|||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test connecting genesis coinbase"""
|
||||
|
||||
from test_framework.messages import COIN
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error
|
||||
from test_framework.script import OP_TRUE, CScriptOp
|
||||
|
||||
NUM_INITIAL_COINS = 50
|
||||
|
||||
class ConnectGenesisTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = True
|
||||
# First node doesn't connect coinbase output to db, second does
|
||||
self.extra_args = [["-con_connect_coinbase=0", "-initialfreecoins=5000000000"], ["-con_connect_coinbase=1", "-initialfreecoins=5000000000"]]
|
||||
self.extra_args = [["-con_connect_coinbase=0", "-initialfreecoins={}".format(NUM_INITIAL_COINS * COIN)],
|
||||
["-con_connect_coinbase=1", "-initialfreecoins={}".format(NUM_INITIAL_COINS * COIN), '-anyonecanspendaremine=1']]
|
||||
|
||||
def run_test(self):
|
||||
# Same genesis block
|
||||
|
|
@ -28,11 +33,19 @@ class ConnectGenesisTest(BitcoinTestFramework):
|
|||
assert_equal(node0_info["total_amount"], 0)
|
||||
assert_equal(node1_info["txouts"], 1)
|
||||
assert_equal(node1_info["transactions"], 1)
|
||||
assert_equal(node1_info["total_amount"], 50)
|
||||
assert_equal(node1_info["total_amount"], NUM_INITIAL_COINS)
|
||||
|
||||
coinbase_tx = self.nodes[0].getblock(self.nodes[0].getblockhash(0))["tx"][0]
|
||||
issuance_tx = self.nodes[0].getblock(self.nodes[0].getblockhash(0))["tx"][1]
|
||||
|
||||
# Test listunspent
|
||||
unspent = self.nodes[1].listunspent()
|
||||
assert_equal(len(unspent), 1)
|
||||
assert_equal(unspent[0]["vout"], 0)
|
||||
assert_equal(CScriptOp(int(unspent[0]["scriptPubKey"], 16)), OP_TRUE)
|
||||
assert_equal(unspent[0]["amount"], NUM_INITIAL_COINS)
|
||||
assert_equal(unspent[0]["confirmations"], 1)
|
||||
|
||||
# Test rpc getraw functionality
|
||||
|
||||
# Coinbase transaction is provably unspendable (OP_RETURN), so even AddCoin won't add it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue