multi: use btcd's btcec/v2 and btcutil modules

This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
This commit is contained in:
Oliver Gugger committed 2022-03-09 19:02:37 +01:00
1 parent 8ee9fc837b
commit 7dfe4018ce
350 files changed
+2421 -1289

No files matched your search

+11 -19
View File
@@ -2,12 +2,13 @@ package migration21
import (
"bytes"
"encoding/hex"
"fmt"
"math/big"
"reflect"
"testing"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/davecgh/go-spew/spew"
@@ -27,16 +28,17 @@ var (
0x1e, 0xb, 0x4c, 0xf9, 0x9e, 0xc5, 0x8c, 0xe9,
}
_, pubKey = btcec.PrivKeyFromBytes(btcec.S256(), key[:])
_, pubKey = btcec.PrivKeyFromBytes(key[:])
wireSig, _ = lnwire.NewSigFromSignature(testSig)
testSig = &btcec.Signature{
R: new(big.Int),
S: new(big.Int),
}
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
testRBytes, _ = hex.DecodeString("8ce2bc69281ce27da07e6683571319d18e949ddfa2965fb6caa1bf0314f882d7")
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a88121167221b6700d72a0ead154c03be696a292d24ae")
testRScalar = new(btcec.ModNScalar)
testSScalar = new(btcec.ModNScalar)
_ = testRScalar.SetByteSlice(testRBytes)
_ = testSScalar.SetByteSlice(testSBytes)
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
testTx = &wire.MsgTx{
Version: 1,
@@ -390,16 +392,6 @@ func TestMigrateDatabaseWireMessages(t *testing.T) {
return err
}
testChanCloseSummary.RemotePub.Curve = nil
testChanCloseSummary.RemoteCurrentRevocation.Curve = nil
testChanCloseSummary.RemoteNextRevocation.Curve = nil
testChanCloseSummary.LastChanSyncMsg.LocalUnrevokedCommitPoint.Curve = nil
newChanCloseSummary.RemotePub.Curve = nil
newChanCloseSummary.RemoteCurrentRevocation.Curve = nil
newChanCloseSummary.RemoteNextRevocation.Curve = nil
newChanCloseSummary.LastChanSyncMsg.LocalUnrevokedCommitPoint.Curve = nil
if !reflect.DeepEqual(
newChanCloseSummary, testChanCloseSummary,
) {