lnd: partially fix golint warnings
This commit is contained in:
1 parent
92dec2a902
commit
fd97a4bd19
38 files changed
+229
-233
No files matched your search
@@ -23,7 +23,7 @@ func (b *BtcWallet) GetBestBlock() (*chainhash.Hash, int32, error) {
|
||||
return b.rpc.GetBestBlock()
|
||||
}
|
||||
|
||||
// GetTxOut returns the original output referenced by the passed outpoint.
|
||||
// GetUtxo returns the original output referenced by the passed outpoint.
|
||||
//
|
||||
// This method is a part of the lnwallet.BlockChainIO interface.
|
||||
func (b *BtcWallet) GetUtxo(txid *chainhash.Hash, index uint32) (*wire.TxOut, error) {
|
||||
|
||||
@@ -100,8 +100,8 @@ func New(cfg *Config) (*BtcWallet, error) {
|
||||
|
||||
// Create a special websockets rpc client for btcd which will be used
|
||||
// by the wallet for notifications, calls, etc.
|
||||
rpcc, err := chain.NewRPCClient(cfg.NetParams, cfg.RpcHost,
|
||||
cfg.RpcUser, cfg.RpcPass, cfg.CACert, false, 20)
|
||||
rpcc, err := chain.NewRPCClient(cfg.NetParams, cfg.RPCHost,
|
||||
cfg.RPCUser, cfg.RPCPass, cfg.CACert, false, 20)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -208,9 +208,9 @@ func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool) (btcutil.Add
|
||||
|
||||
if change {
|
||||
return b.wallet.NewChangeAddress(defaultAccount, addrType)
|
||||
} else {
|
||||
return b.wallet.NewAddress(defaultAccount, addrType)
|
||||
}
|
||||
|
||||
return b.wallet.NewAddress(defaultAccount, addrType)
|
||||
}
|
||||
|
||||
// GetPrivKey retrives the underlying private key associated with the passed
|
||||
|
||||
@@ -46,23 +46,23 @@ type Config struct {
|
||||
// logger should use.
|
||||
DebugLevel string
|
||||
|
||||
// RpcHost is the host and port to use to reach the rpc sever.
|
||||
RpcHost string // localhost:18334
|
||||
// RPCHost is the host and port to use to reach the rpc sever.
|
||||
RPCHost string // localhost:18334
|
||||
|
||||
// RpcUser is the username which should be used to authentiate with the
|
||||
// RPCUser is the username which should be used to authentiate with the
|
||||
// rpc server.
|
||||
RpcUser string
|
||||
RPCUser string
|
||||
|
||||
// RpcPass is the password which should be used to authenticate the
|
||||
// RPCPass is the password which should be used to authenticate the
|
||||
// connection with the RPC server.
|
||||
RpcPass string
|
||||
RPCPass string
|
||||
|
||||
// RpcNoTLS denotes if a TLS connection should be attempted when
|
||||
// RPCNoTLS denotes if a TLS connection should be attempted when
|
||||
// connecting to the RPC server.
|
||||
RpcNoTLS bool
|
||||
RPCNoTLS bool
|
||||
|
||||
// RPCCert directory where the TLS certificate of the RPC sever is
|
||||
// stored. If the RpcNoTLS is false, then this value will be unused.
|
||||
// stored. If the RPCNoTLS is false, then this value will be unused.
|
||||
RPCCert string
|
||||
RPCKey string
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const (
|
||||
// nested p2wkh output.
|
||||
NestedWitnessPubKey
|
||||
|
||||
// PublicKey represents a regular p2pkh output.
|
||||
// PubKeyHash represents a regular p2pkh output.
|
||||
PubKeyHash
|
||||
)
|
||||
|
||||
|
||||
@@ -1286,9 +1286,9 @@ func TestLightningWallet(t *testing.T) {
|
||||
HdSeed: testHdSeed[:],
|
||||
DataDir: tempTestDir,
|
||||
NetParams: netParams,
|
||||
RpcHost: rpcConfig.Host,
|
||||
RpcUser: rpcConfig.User,
|
||||
RpcPass: rpcConfig.Pass,
|
||||
RPCHost: rpcConfig.Host,
|
||||
RPCUser: rpcConfig.User,
|
||||
RPCPass: rpcConfig.Pass,
|
||||
CACert: rpcConfig.Certificates,
|
||||
}
|
||||
wc, err = walletDriver.New(btcwalletConfig)
|
||||
|
||||
@@ -51,7 +51,7 @@ type ChannelContribution struct {
|
||||
CsvDelay uint32
|
||||
}
|
||||
|
||||
// InputScripts represents any script inputs required to redeem a previous
|
||||
// InputScript represents any script inputs required to redeem a previous
|
||||
// output. This struct is used rather than just a witness, or scripSig in
|
||||
// order to accommodate nested p2sh which utilizes both types of input scripts.
|
||||
type InputScript struct {
|
||||
@@ -349,7 +349,7 @@ func (r *ChannelReservation) CompleteReservationSingle(
|
||||
return <-completeChan, <-errChan
|
||||
}
|
||||
|
||||
// OurSignatures returns the counterparty's signatures to all inputs to the
|
||||
// TheirSignatures returns the counterparty's signatures to all inputs to the
|
||||
// funding transaction belonging to them, as well as their signature for the
|
||||
// wallet's version of the commitment transaction. This methods is provided for
|
||||
// additional verification, such as needed by tests.
|
||||
@@ -393,7 +393,7 @@ func (r *ChannelReservation) LocalCommitTx() *wire.MsgTx {
|
||||
return r.partialState.OurCommitTx
|
||||
}
|
||||
|
||||
// SetDustLimit set dust limit of the remote party.
|
||||
// SetTheirDustLimit set dust limit of the remote party.
|
||||
func (r *ChannelReservation) SetTheirDustLimit(dustLimit btcutil.Amount) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -20,8 +20,8 @@ import (
|
||||
var (
|
||||
// TODO(roasbeef): remove these and use the one's defined in txscript
|
||||
// within testnet-L.
|
||||
|
||||
SequenceLockTimeSeconds = uint32(1 << 22)
|
||||
SequenceLockTimeMask = uint32(0x0000ffff)
|
||||
OP_CHECKSEQUENCEVERIFY byte = txscript.OP_NOP3
|
||||
|
||||
// TimelockShift is used to make sure the commitment transaction is
|
||||
|
||||
+15
-18
@@ -5,9 +5,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
WitnessFactor = blockchain.WitnessScaleFactor
|
||||
MaxTransactionWeightPolicy = blockchain.MaxBlockWeight / 10
|
||||
|
||||
// The weight(cost), which is different from the !size! (see BIP-141),
|
||||
// is calculated as:
|
||||
// Weight = 4 * BaseSize + WitnessSize (weight).
|
||||
@@ -15,19 +12,19 @@ const (
|
||||
// WitnessSize - witness size (bytes).
|
||||
// Weight - the metric for determining the cost of the transaction.
|
||||
|
||||
// P2WSH: 34 bytes
|
||||
// P2WSHSize 34 bytes
|
||||
// - OP_0: 1 byte
|
||||
// - OP_DATA: 1 byte (WitnessScriptSHA256 length)
|
||||
// - WitnessScriptSHA256: 32 bytes
|
||||
P2WSHSize = 1 + 1 + 32
|
||||
|
||||
// P2WPKH: 22 bytes
|
||||
// P2WPKHSize 22 bytes
|
||||
// - OP_0: 1 byte
|
||||
// - OP_DATA: 1 byte (PublicKeyHASH160 length)
|
||||
// - PublicKeyHASH160: 20 bytes
|
||||
P2WPKHSize = 1 + 1 + 20
|
||||
|
||||
// MultiSig: 71 bytes
|
||||
// MultiSigSize 71 bytes
|
||||
// - OP_2: 1 byte
|
||||
// - OP_DATA: 1 byte (pubKeyAlice length)
|
||||
// - pubKeyAlice: 33 bytes
|
||||
@@ -37,7 +34,7 @@ const (
|
||||
// - OP_CHECKMULTISIG: 1 byte
|
||||
MultiSigSize = 1 + 1 + 33 + 1 + 33 + 1 + 1
|
||||
|
||||
// Witness: 222 bytes
|
||||
// WitnessSize 222 bytes
|
||||
// - NumberOfWitnessElements: 1 byte
|
||||
// - NilLength: 1 byte
|
||||
// - sigAliceLength: 1 byte
|
||||
@@ -48,7 +45,7 @@ const (
|
||||
// - WitnessScript (MultiSig)
|
||||
WitnessSize = 1 + 1 + 1 + 73 + 1 + 73 + 1 + MultiSigSize
|
||||
|
||||
// FundingInput: 41 bytes
|
||||
// FundingInputSize 41 bytes
|
||||
// - PreviousOutPoint:
|
||||
// - Hash: 32 bytes
|
||||
// - Index: 4 bytes
|
||||
@@ -62,30 +59,30 @@ const (
|
||||
// - Sequence: 4 bytes
|
||||
FundingInputSize = 32 + 4 + 1 + 4
|
||||
|
||||
// OutputPayingToUs: 43 bytes
|
||||
// CommitmentDelayOutput 43 bytes
|
||||
// - Value: 8 bytes
|
||||
// - VarInt: 1 byte (PkScript length)
|
||||
// - PkScript (P2WSH)
|
||||
CommitmentDelayOutput = 8 + 1 + P2WSHSize
|
||||
|
||||
// OutputPayingToThem: 31 bytes
|
||||
// CommitmentKeyHashOutput 31 bytes
|
||||
// - Value: 8 bytes
|
||||
// - VarInt: 1 byte (PkScript length)
|
||||
// - PkScript (P2WPKH)
|
||||
CommitmentKeyHashOutput = 8 + 1 + P2WPKHSize
|
||||
|
||||
// HTLCOutput: 43 bytes
|
||||
// HTLCSize 43 bytes
|
||||
// - Value: 8 bytes
|
||||
// - VarInt: 1 byte (PkScript length)
|
||||
// - PkScript (PW2SH)
|
||||
HTLCSize = 8 + 1 + P2WSHSize
|
||||
|
||||
// WitnessHeader: 2 bytes
|
||||
// WitnessHeaderSize 2 bytes
|
||||
// - Flag: 1 byte
|
||||
// - Marker: 1 byte
|
||||
WitnessHeaderSize = 1 + 1
|
||||
|
||||
// CommitmentTransaction: 125 43 * num-htlc-outputs bytes
|
||||
// BaseCommitmentTxSize 125 43 * num-htlc-outputs bytes
|
||||
// - Version: 4 bytes
|
||||
// - WitnessHeader <---- part of the witness data
|
||||
// - CountTxIn: 1 byte
|
||||
@@ -100,14 +97,14 @@ const (
|
||||
BaseCommitmentTxSize = 4 + 1 + FundingInputSize + 1 +
|
||||
CommitmentDelayOutput + CommitmentKeyHashOutput + 4
|
||||
|
||||
// CommitmentTransactionCost: 500 weight
|
||||
BaseCommitmentTxCost = WitnessFactor * BaseCommitmentTxSize
|
||||
// BaseCommitmentTxCost 500 weight
|
||||
BaseCommitmentTxCost = blockchain.WitnessScaleFactor * BaseCommitmentTxSize
|
||||
|
||||
// WitnessCommitmentTxCost: 224 weight
|
||||
// WitnessCommitmentTxCost 224 weight
|
||||
WitnessCommitmentTxCost = WitnessHeaderSize + WitnessSize
|
||||
|
||||
// HTLCCost: 172 weight
|
||||
HTLCCost = WitnessFactor * HTLCSize
|
||||
// HTLCCost 172 weight
|
||||
HTLCCost = blockchain.WitnessScaleFactor * HTLCSize
|
||||
|
||||
// MaxHTLCNumber shows as the maximum number HTLCs which can be
|
||||
// included in commitment transaction. This numbers was calculated by
|
||||
|
||||
+1
-1
@@ -390,7 +390,7 @@ func (l *LightningWallet) Shutdown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LockOutpoints returns a list of all currently locked outpoint.
|
||||
// LockedOutpoints returns a list of all currently locked outpoint.
|
||||
func (l *LightningWallet) LockedOutpoints() []*wire.OutPoint {
|
||||
outPoints := make([]*wire.OutPoint, 0, len(l.lockedOutPoints))
|
||||
for outPoint := range l.lockedOutPoints {
|
||||
|
||||
Reference in new issue
Block a user