Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tests for bitcoin testnet4 #1147

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Conversation

grdddj
Copy link
Contributor

@grdddj grdddj commented Oct 22, 2024

Integrating the code related to this issue - #1130

The credit for tests goes to @wakiyamap

@grdddj grdddj requested a review from martinboehm October 22, 2024 11:38
@grdddj grdddj force-pushed the grdddj/wakiyamap_testnet_4_tests branch from 9437d78 to 1297f09 Compare October 29, 2024 12:51
@wakiyamap
Copy link
Contributor

wakiyamap commented Nov 9, 2024

--- a/bchain/coins/btc/bitcoinparser.go
+++ b/bchain/coins/btc/bitcoinparser.go
@@ -50,7 +50,7 @@ func GetChainParams(chain string) *chaincfg.Params {
        switch chain {
        case "test":
                return &chaincfg.TestNet3Params
-       case "test4":
+       case "testnet4":

+++ b/bchain/coins/btc/bitcoinparser_test.go
@@ -682,7 +682,7 @@ func TestPackTx(t *testing.T) {
                                tx:        testTx4,
                                height:    41657,
                                blockTime: 1724927392,
-                               parser:    NewBitcoinParser(GetChainParams("test4"), &Configuration{}),
+                               parser:    NewBitcoinParser(GetChainParams("testnet4"), &Configuration{}),
                        },
                        want:    testTxPacked4,
                        wantErr: false,
@@ -749,7 +749,7 @@ func TestUnpackTx(t *testing.T) {
                        name: "testnet4-1",
                        args: args{
                                packedTx: testTxPacked4,
-                               parser:   NewBitcoinParser(GetChainParams("test4"), &Configuration{}),
+                               parser:   NewBitcoinParser(GetChainParams("testnet4"), &Configuration{}),
                        },
                        want:    &testTx4,
                        want1:   41657,

When getblockchaininfo was testnet4, it returned testnet4 instead of test4.
Therefore, this code will run with mainnet parameters.
https://github.com/wakiyamap/blockbook/commits/testnet4-bitcoin/
https://testnet4-explorer.wakiyamap.dev/

It's fine to leave testnet3 as test.
https://tbtc1.trezor.io/

@grdddj grdddj force-pushed the grdddj/wakiyamap_testnet_4_tests branch from 2a5af19 to 0599948 Compare November 25, 2024 15:24
@martinboehm martinboehm merged commit f373a73 into master Nov 25, 2024
@martinboehm martinboehm deleted the grdddj/wakiyamap_testnet_4_tests branch November 25, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants