Skip to content

Commit

Permalink
Fix TestWalletRegistry_getWalletByPublicKeyHash_NotFound test
Browse files Browse the repository at this point in the history
This test used a dummy curve point that was not on the curve.
Since Go 1.19, such a behavior leads to a panic. Here we fix
that by using a proper point that is on the curve.

See: https://tip.golang.org/doc/go1.19 > Minor changes to the library > crypto/elliptic
  • Loading branch information
lukasz-zimnoch committed Feb 6, 2024
1 parent 2ed7179 commit 50b6bd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/tbtc/registry_test.go
Expand Up @@ -120,10 +120,12 @@ func TestWalletRegistry_getWalletByPublicKeyHash_NotFound(t *testing.T) {
t.Fatal(err)
}

x, y := tecdsa.Curve.ScalarBaseMult(big.NewInt(100).Bytes())

walletPublicKeyHash := bitcoin.PublicKeyHash(&ecdsa.PublicKey{
Curve: tecdsa.Curve,
X: big.NewInt(100),
Y: big.NewInt(200),
X: x,
Y: y,
})

_, ok := walletRegistry.getWalletByPublicKeyHash(walletPublicKeyHash)
Expand Down

0 comments on commit 50b6bd6

Please sign in to comment.