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:
350 files changed
+2421
-1289
No files matched your search
+13
-17
@@ -11,13 +11,14 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/blockchain"
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil/txsort"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcutil/txsort"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
@@ -303,7 +304,7 @@ type PaymentDescriptor struct {
|
||||
// local node. This signature is generated by the remote node and
|
||||
// stored by the local node in the case that local node needs to
|
||||
// broadcast their commitment transaction.
|
||||
sig *btcec.Signature
|
||||
sig *ecdsa.Signature
|
||||
|
||||
// addCommitHeight[Remote|Local] encodes the height of the commitment
|
||||
// which included this HTLC on either the remote or local commitment
|
||||
@@ -2297,7 +2298,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
|
||||
return nil, err
|
||||
}
|
||||
commitmentSecret, commitmentPoint := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), revocationPreimage[:],
|
||||
revocationPreimage[:],
|
||||
)
|
||||
|
||||
// With the commitment point generated, we can now generate the four
|
||||
@@ -4105,7 +4106,7 @@ func genHtlcSigValidationJobs(localCommitmentView *commitment,
|
||||
var (
|
||||
htlcIndex uint64
|
||||
sigHash func() ([]byte, error)
|
||||
sig *btcec.Signature
|
||||
sig *ecdsa.Signature
|
||||
err error
|
||||
)
|
||||
|
||||
@@ -4421,16 +4422,13 @@ func (lc *LightningChannel) ReceiveNewCommitment(commitSig lnwire.Sig,
|
||||
// While the HTLC verification jobs are proceeding asynchronously,
|
||||
// we'll ensure that the newly constructed commitment state has a valid
|
||||
// signature.
|
||||
verifyKey := btcec.PublicKey{
|
||||
X: lc.channelState.RemoteChanCfg.MultiSigKey.PubKey.X,
|
||||
Y: lc.channelState.RemoteChanCfg.MultiSigKey.PubKey.Y,
|
||||
Curve: btcec.S256(),
|
||||
}
|
||||
verifyKey := lc.channelState.RemoteChanCfg.MultiSigKey.PubKey
|
||||
|
||||
cSig, err := commitSig.ToSignature()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !cSig.Verify(sigHash, &verifyKey) {
|
||||
if !cSig.Verify(sigHash, verifyKey) {
|
||||
close(cancelChan)
|
||||
|
||||
// If we fail to validate their commitment signature, we'll
|
||||
@@ -5485,9 +5483,7 @@ func (lc *LightningChannel) getSignedCommitTx() (*wire.MsgTx, error) {
|
||||
localCommit := lc.channelState.LocalCommitment
|
||||
commitTx := localCommit.CommitTx.Copy()
|
||||
|
||||
theirSig, err := btcec.ParseDERSignature(
|
||||
localCommit.CommitSig, btcec.S256(),
|
||||
)
|
||||
theirSig, err := ecdsa.ParseDERSignature(localCommit.CommitSig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -5906,7 +5902,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
|
||||
InputIndex: 0,
|
||||
}
|
||||
|
||||
htlcSig, err := btcec.ParseDERSignature(htlc.Signature, btcec.S256())
|
||||
htlcSig, err := ecdsa.ParseDERSignature(htlc.Signature)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -6041,7 +6037,7 @@ func newIncomingHtlcResolution(signer input.Signer,
|
||||
InputIndex: 0,
|
||||
}
|
||||
|
||||
htlcSig, err := btcec.ParseDERSignature(htlc.Signature, btcec.S256())
|
||||
htlcSig, err := ecdsa.ParseDERSignature(htlc.Signature)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user