forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#429: [0.17] Connect gen block tx to db, don't validate …
…gen block d97920c add functional test for coinbase connection to db (Gregory Sanders) e532664 allow grabbing genesis transaction(s) when connected (Gregory Sanders) c7e5549 [bitcoin#9102] really don't validate genesis block (Gregory Sanders) ccf40db connect genesis block transaction outputs to coin db (Gregory Sanders) Pull request description: Tests should now be working. Tree-SHA512: aa2af6637c534d7f9185e969118b52519fe0609ae79fa8f4d5213f939f9a5915f958cf93d02aa6f4a47795c87cc23c93daff3807347cb1b12a426326e6dea60e
- Loading branch information
Showing
8 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2014-2018 The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
"""Test connecting genesis coinbase""" | ||
|
||
from test_framework.test_framework import BitcoinTestFramework | ||
from test_framework.util import assert_equal, assert_raises_rpc_error | ||
|
||
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"], ["-con_connect_coinbase=1"]] | ||
|
||
def run_test(self): | ||
# Same genesis block | ||
assert_equal(self.nodes[0].getblockhash(0), self.nodes[1].getblockhash(0)) | ||
|
||
# Different UTXO set | ||
node0_info = self.nodes[0].gettxoutsetinfo() | ||
node1_info = self.nodes[1].gettxoutsetinfo() | ||
print(node0_info) | ||
print(node1_info) | ||
assert_equal(node0_info["txouts"], 0) | ||
assert_equal(node0_info["transactions"], 0) | ||
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) | ||
|
||
coinbase_tx = self.nodes[0].getblock(self.nodes[0].getblockhash(0))["tx"][0] | ||
|
||
# Test rpc getraw functionality | ||
assert_raises_rpc_error(-5, "The genesis block coinbase is not considered an ordinary transaction and cannot be retrieved", self.nodes[0].getrawtransaction, coinbase_tx) | ||
self.nodes[1].getrawtransaction(coinbase_tx) | ||
|
||
if __name__ == '__main__': | ||
ConnectGenesisTest().main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters