multi: formatting and comment fixes
This commit is contained in:
160 files changed
+159
-260
No files matched your search
@@ -157,7 +157,6 @@ func (d *AddInvoiceData) paymentHashAndPreimage() (
|
||||
// The preimage will always be nil.
|
||||
func (d *AddInvoiceData) ampPaymentHashAndPreimage() (*lntypes.Preimage, lntypes.Hash, error) {
|
||||
switch {
|
||||
|
||||
// Preimages cannot be set on AMP invoice.
|
||||
case d.Preimage != nil:
|
||||
return nil, lntypes.Hash{},
|
||||
@@ -285,7 +284,6 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
|
||||
}
|
||||
|
||||
switch {
|
||||
|
||||
// If expiry is set, specify it. If it is not provided, no expiry time
|
||||
// will be explicitly added to this payment request, which will imply
|
||||
// the default 3600 seconds.
|
||||
@@ -313,7 +311,6 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
|
||||
// Otherwise, use the default AMP expiry.
|
||||
default:
|
||||
options = append(options, zpay32.Expiry(DefaultAMPInvoiceExpiry))
|
||||
|
||||
}
|
||||
|
||||
// If the description hash is set, then we add it do the list of options.
|
||||
@@ -661,7 +658,7 @@ func sufficientHints(numHints, maxHints, scalingFactor int, amount,
|
||||
// channels. The set of hop hints will be returned as a slice of functional
|
||||
// options that'll append the route hint to the set of all route hints.
|
||||
//
|
||||
// TODO(roasbeef): do proper sub-set sum max hints usually << numChans
|
||||
// TODO(roasbeef): do proper sub-set sum max hints usually << numChans.
|
||||
func SelectHopHints(amtMSat lnwire.MilliSatoshi, cfg *SelectHopHintsCfg,
|
||||
openChannels []*HopHintInfo,
|
||||
numMaxHophints int) [][]zpay32.HopHint {
|
||||
|
||||
@@ -461,7 +461,6 @@ func TestSelectHopHints(t *testing.T) {
|
||||
setMockChannelUsed(
|
||||
h, private1ShortID, privateChan1Policy,
|
||||
)
|
||||
|
||||
},
|
||||
// Add two channels that we'd want to use, but the
|
||||
// second one will be cut off due to our hop hint count
|
||||
|
||||
@@ -38,7 +38,6 @@ func decodePayReq(invoice *channeldb.Invoice,
|
||||
"request: %v", err)
|
||||
}
|
||||
return decoded, nil
|
||||
|
||||
}
|
||||
|
||||
// CreateRPCInvoice creates an *lnrpc.Invoice from the *channeldb.Invoice.
|
||||
@@ -179,7 +178,6 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
||||
|
||||
rpcInvoice.AmpInvoiceState = make(map[string]*lnrpc.AMPInvoiceState)
|
||||
for setID, ampState := range invoice.AMPState {
|
||||
|
||||
setIDStr := hex.EncodeToString(setID[:])
|
||||
|
||||
var state lnrpc.InvoiceHTLCState
|
||||
|
||||
@@ -27,7 +27,6 @@ func CalculateFeeLimit(feeLimit *FeeLimit,
|
||||
amount lnwire.MilliSatoshi) lnwire.MilliSatoshi {
|
||||
|
||||
switch feeLimit.GetLimit().(type) {
|
||||
|
||||
case *FeeLimit_Fixed:
|
||||
return lnwire.NewMSatFromSatoshis(
|
||||
btcutil.Amount(feeLimit.GetFixed()),
|
||||
@@ -89,7 +88,6 @@ func MarshalUtxos(utxos []*lnwallet.Utxo, activeNetParams *chaincfg.Params) (
|
||||
// address type.
|
||||
var addrType AddressType
|
||||
switch utxo.AddressType {
|
||||
|
||||
case lnwallet.WitnessPubKey:
|
||||
addrType = AddressType_WITNESS_PUBKEY_HASH
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ const (
|
||||
// for MPP when the user is attempting to send a payment.
|
||||
//
|
||||
// TODO(roasbeef): make this value dynamic based on expected number of
|
||||
// attempts for given amount
|
||||
// attempts for given amount.
|
||||
DefaultMaxParts = 16
|
||||
)
|
||||
|
||||
@@ -1008,7 +1008,6 @@ func UnmarshalMPP(reqMPP *lnrpc.MPPRecord) (*record.MPP, error) {
|
||||
reqAddr := reqMPP.PaymentAddr
|
||||
|
||||
switch {
|
||||
|
||||
// No MPP fields were provided.
|
||||
case reqTotal == 0 && len(reqAddr) == 0:
|
||||
return nil, fmt.Errorf("missing total_msat and payment_addr")
|
||||
@@ -1110,7 +1109,6 @@ func marshallHtlcFailure(failure *channeldb.HTLCFailInfo) (*lnrpc.Failure,
|
||||
}
|
||||
|
||||
switch failure.Reason {
|
||||
|
||||
case channeldb.HTLCFailUnknown:
|
||||
rpcFailure.Code = lnrpc.Failure_UNKNOWN_FAILURE
|
||||
|
||||
@@ -1191,7 +1189,6 @@ func marshallWireError(msg lnwire.FailureMessage,
|
||||
response *lnrpc.Failure) error {
|
||||
|
||||
switch onionErr := msg.(type) {
|
||||
|
||||
case *lnwire.FailIncorrectDetails:
|
||||
response.Code = lnrpc.Failure_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS
|
||||
response.Height = onionErr.Height()
|
||||
@@ -1412,7 +1409,6 @@ func marshallPaymentFailureReason(reason *channeldb.FailureReason) (
|
||||
}
|
||||
|
||||
switch *reason {
|
||||
|
||||
case channeldb.FailureReasonTimeout:
|
||||
return lnrpc.PaymentFailureReason_FAILURE_REASON_TIMEOUT, nil
|
||||
|
||||
|
||||
@@ -336,7 +336,6 @@ func TestUnmarshalMPP(t *testing.T) {
|
||||
func testUnmarshalMPP(t *testing.T, test unmarshalMPPTest) {
|
||||
mpp, err := UnmarshalMPP(test.mpp)
|
||||
switch test.outcome {
|
||||
|
||||
// Valid arguments should result in no error, a non-nil MPP record, and
|
||||
// the fields should be set correctly.
|
||||
case valid:
|
||||
|
||||
@@ -141,9 +141,7 @@ func rpcFailReason(linkErr *htlcswitch.LinkError) (lnrpc.Failure_FailureCode,
|
||||
default:
|
||||
return 0, 0, fmt.Errorf("unknown failure "+
|
||||
"detail type: %T", linkErr.FailureDetail)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// rpcFailureResolution maps an invoice failure resolution to a rpc failure
|
||||
|
||||
@@ -632,7 +632,6 @@ func (s *Server) DeriveSharedKey(_ context.Context, in *SharedKeyRequest) (
|
||||
// is zero.
|
||||
func parseRawKeyBytes(rawKeyBytes []byte) (*btcec.PublicKey, error) {
|
||||
switch {
|
||||
|
||||
case len(rawKeyBytes) == 33:
|
||||
// If a proper raw key was provided, then we'll attempt
|
||||
// to decode and parse it.
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
const (
|
||||
// SubServerName is the name of the sub rpc server. We'll use this name
|
||||
// to register ourselves, and we also require that the main
|
||||
// SubServerConfigDispatcher instance recognize as the name of our
|
||||
// SubServerConfigDispatcher instance recognize as the name of our.
|
||||
SubServerName = "WalletKitRPC"
|
||||
)
|
||||
|
||||
|
||||
@@ -1399,6 +1399,7 @@ func (w *WalletKit) ListAccounts(ctx context.Context,
|
||||
// wallet in the response if they don't have any keys imported.
|
||||
if account.AccountName == waddrmgr.ImportedAddrAccountName &&
|
||||
account.ImportedKeyCount == 0 {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user