Skip to content

Commit

Permalink
Merge pull request lightningnetwork#9309 from yyforyongyu/fix-unit-test
Browse files Browse the repository at this point in the history
chainntnfs: fix `TestHistoricalConfDetailsTxIndex`
  • Loading branch information
guggero authored Dec 12, 2024
2 parents 55b685d + 5867f00 commit 6298f76
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
12 changes: 10 additions & 2 deletions chainntnfs/bitcoindnotify/bitcoind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,15 @@ func syncNotifierWithMiner(t *testing.T, notifier *BitcoindNotifier,
// TestHistoricalConfDetailsTxIndex ensures that we correctly retrieve
// historical confirmation details using the backend node's txindex.
func TestHistoricalConfDetailsTxIndex(t *testing.T) {
t.Run("rpc polling enabled", func(st *testing.T) {
success := t.Run("rpc polling enabled", func(st *testing.T) {
st.Parallel()
testHistoricalConfDetailsTxIndex(st, true)
})

if !success {
return
}

t.Run("rpc polling disabled", func(st *testing.T) {
st.Parallel()
testHistoricalConfDetailsTxIndex(st, false)
Expand Down Expand Up @@ -207,11 +211,15 @@ func testHistoricalConfDetailsTxIndex(t *testing.T, rpcPolling bool) {
// historical confirmation details using the set of fallback methods when the
// backend node's txindex is disabled.
func TestHistoricalConfDetailsNoTxIndex(t *testing.T) {
t.Run("rpc polling enabled", func(st *testing.T) {
success := t.Run("rpc polling enabled", func(st *testing.T) {
st.Parallel()
testHistoricalConfDetailsNoTxIndex(st, true)
})

if !success {
return
}

t.Run("rpc polling disabled", func(st *testing.T) {
st.Parallel()
testHistoricalConfDetailsNoTxIndex(st, false)
Expand Down
6 changes: 5 additions & 1 deletion chainntnfs/test/bitcoind/bitcoind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ import (
// TestInterfaces executes the generic notifier test suite against a bitcoind
// powered chain notifier.
func TestInterfaces(t *testing.T) {
t.Run("bitcoind", func(st *testing.T) {
success := t.Run("bitcoind", func(st *testing.T) {
st.Parallel()
chainntnfstest.TestInterfaces(st, "bitcoind")
})

if !success {
return
}

t.Run("bitcoind rpc polling", func(st *testing.T) {
st.Parallel()
chainntnfstest.TestInterfaces(st, "bitcoind-rpc-polling")
Expand Down
6 changes: 5 additions & 1 deletion chainntnfs/txnotifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestTxNotifierRegistrationValidation(t *testing.T) {

for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
success := t.Run(testCase.name, func(t *testing.T) {
hintCache := newMockHintCache()
n := chainntnfs.NewTxNotifier(
10, chainntnfs.ReorgSafetyLimit, hintCache, hintCache,
Expand Down Expand Up @@ -201,6 +201,10 @@ func TestTxNotifierRegistrationValidation(t *testing.T) {
"\"%v\", got \"%v\"", testCase.err, err)
}
})

if !success {
return
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344
github.com/andybalholm/brotli v1.0.4
github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53
github.com/btcsuite/btcd v0.24.3-0.20241210095828-e646d437e95b
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.5
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 h1:XOZ/wRGHkKv0AqxfDks5IkzaQ1Ge6fq322ZOOG5VIkU=
github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53/go.mod h1:zHK7t7sw8XbsCkD64WePHE3r3k9/XoGAcf6mXV14c64=
github.com/btcsuite/btcd v0.24.3-0.20241210095828-e646d437e95b h1:VQoobSrWdxICuqFU3tKVu/Lzk7BTk9SsCgRr5dUvC70=
github.com/btcsuite/btcd v0.24.3-0.20241210095828-e646d437e95b/go.mod h1:zHK7t7sw8XbsCkD64WePHE3r3k9/XoGAcf6mXV14c64=
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
Expand Down

0 comments on commit 6298f76

Please sign in to comment.