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
@@ -5,9 +5,9 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/blockchain"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
||||
@@ -19,11 +19,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@@ -432,7 +432,7 @@ func initBreachedOutputs() error {
|
||||
bo := &breachedOutputs[i]
|
||||
|
||||
// Parse the sign descriptor's pubkey.
|
||||
pubkey, err := btcec.ParsePubKey(breachKeys[i], btcec.S256())
|
||||
pubkey, err := btcec.ParsePubKey(breachKeys[i])
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to parse pubkey: %v",
|
||||
breachKeys[i])
|
||||
@@ -1216,7 +1216,7 @@ func TestBreachCreateJusticeTx(t *testing.T) {
|
||||
// to the justice tx, not that we create a valid spend, so we just set
|
||||
// some params making the script generation succeed.
|
||||
aliceKeyPriv, _ := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), channels.AlicesPrivKey,
|
||||
channels.AlicesPrivKey,
|
||||
)
|
||||
alicePubKey := aliceKeyPriv.PubKey()
|
||||
|
||||
@@ -2164,8 +2164,7 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent,
|
||||
return NewRetributionStore(db)
|
||||
})
|
||||
|
||||
aliceKeyPriv, _ := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
channels.AlicesPrivKey)
|
||||
aliceKeyPriv, _ := btcec.PrivKeyFromBytes(channels.AlicesPrivKey)
|
||||
signer := &mock.SingleSigner{Privkey: aliceKeyPriv}
|
||||
|
||||
// Assemble our test arbiter.
|
||||
@@ -2199,10 +2198,12 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent,
|
||||
// initiator.
|
||||
func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwallet.LightningChannel, func(), error) {
|
||||
|
||||
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
channels.AlicesPrivKey)
|
||||
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
channels.BobsPrivKey)
|
||||
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(
|
||||
channels.AlicesPrivKey,
|
||||
)
|
||||
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(
|
||||
channels.BobsPrivKey,
|
||||
)
|
||||
|
||||
channelCapacity, err := btcutil.NewAmount(10)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
@@ -1209,7 +1209,7 @@ func decodeSignDetails(r io.Reader) (*input.SignDetails, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sig, err := btcec.ParseDERSignature(rawSig, btcec.S256())
|
||||
sig, err := ecdsa.ParseDERSignature(rawSig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"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/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
@@ -135,7 +136,7 @@ var (
|
||||
LockTime: 123,
|
||||
}
|
||||
|
||||
testSig, _ = btcec.ParseDERSignature(channels.TestSigBytes, btcec.S256())
|
||||
testSig, _ = ecdsa.ParseDERSignature(channels.TestSigBytes)
|
||||
|
||||
testSignDetails = &input.SignDetails{
|
||||
SignDesc: testSignDesc,
|
||||
@@ -665,13 +666,6 @@ func TestContractResolutionsStorage(t *testing.T) {
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(&res, diskRes) {
|
||||
for _, h := range res.HtlcResolutions.IncomingHTLCs {
|
||||
h.SweepSignDesc.KeyDesc.PubKey.Curve = nil
|
||||
}
|
||||
for _, h := range diskRes.HtlcResolutions.IncomingHTLCs {
|
||||
h.SweepSignDesc.KeyDesc.PubKey.Curve = nil
|
||||
}
|
||||
|
||||
t.Fatalf("resolution mismatch: expected %v\n, got %v",
|
||||
spew.Sdump(&res), spew.Sdump(diskRes))
|
||||
}
|
||||
@@ -857,7 +851,7 @@ func TestCommitSetStorage(t *testing.T) {
|
||||
}
|
||||
|
||||
func init() {
|
||||
testSignDesc.KeyDesc.PubKey, _ = btcec.ParsePubKey(key1, btcec.S256())
|
||||
testSignDesc.KeyDesc.PubKey, _ = btcec.ParsePubKey(key1)
|
||||
|
||||
prand.Seed(time.Now().Unix())
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@@ -1131,27 +1131,8 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
|
||||
|
||||
spendHeight := uint32(spendEvent.SpendingHeight)
|
||||
|
||||
// Nil the curve before printing.
|
||||
if retribution.RemoteOutputSignDesc != nil &&
|
||||
retribution.RemoteOutputSignDesc.DoubleTweak != nil {
|
||||
retribution.RemoteOutputSignDesc.DoubleTweak.Curve = nil
|
||||
}
|
||||
if retribution.RemoteOutputSignDesc != nil &&
|
||||
retribution.RemoteOutputSignDesc.KeyDesc.PubKey != nil {
|
||||
retribution.RemoteOutputSignDesc.KeyDesc.PubKey.Curve = nil
|
||||
}
|
||||
if retribution.LocalOutputSignDesc != nil &&
|
||||
retribution.LocalOutputSignDesc.DoubleTweak != nil {
|
||||
retribution.LocalOutputSignDesc.DoubleTweak.Curve = nil
|
||||
}
|
||||
if retribution.LocalOutputSignDesc != nil &&
|
||||
retribution.LocalOutputSignDesc.KeyDesc.PubKey != nil {
|
||||
retribution.LocalOutputSignDesc.KeyDesc.PubKey.Curve = nil
|
||||
}
|
||||
|
||||
log.Debugf("Punishment breach retribution created: %v",
|
||||
newLogClosure(func() string {
|
||||
retribution.KeyRing.CommitPoint.Curve = nil
|
||||
retribution.KeyRing.LocalHtlcKey = nil
|
||||
retribution.KeyRing.RemoteHtlcKey = nil
|
||||
retribution.KeyRing.ToLocalKey = nil
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch/hop"
|
||||
"github.com/lightningnetwork/lnd/invoices"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
)
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
||||
@@ -14,11 +14,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
@@ -328,7 +328,7 @@ func init() {
|
||||
// Finish initializing our test vectors by parsing the desired public keys and
|
||||
// properly populating the sign descriptors of all baby and kid outputs.
|
||||
for i := range signDescriptors {
|
||||
pk, err := btcec.ParsePubKey(keys[i], btcec.S256())
|
||||
pk, err := btcec.ParsePubKey(keys[i])
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("unable to parse pub key during init: %v", err))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user