Compare commits

..

No commits in common. "master" and "v0.6.5-beta" have entirely different histories.

64 changed files with 4325 additions and 2682 deletions

View file

@ -1,44 +0,0 @@
name: gateway
# Consumer workflow shim for gateway.
#
# gateway fires on:
# - issue_comment.created — a /gateway <command> comment on a PR
# - pull_request.review_requested — GitHub Re-request review button
# - pull_request.closed — cleanup on close/merge
on:
issue_comment:
types: [created]
pull_request:
types: [review_requested, closed]
permissions:
# The composite action mints an App installation token internally; the
# GITHUB_TOKEN handed to this shim is unused, so we minimise it.
contents: read
jobs:
review:
# issue_comment fires for any issue. Filter to PR comments only.
if: ${{ github.event_name != 'issue_comment' || github.event.issue.pull_request != null }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: lightninglabs/gateway/.github/actions/review@v0.2.0
with:
event_name: ${{ github.event_name }}
event_action: ${{ github.event.action }}
repo: ${{ github.repository }}
pr_number: ${{ github.event.issue.number || github.event.pull_request.number }}
actor: ${{ github.event.sender.login }}
comment_body: ${{ github.event.comment.body }}
comment_id: ${{ github.event.comment.id }}
installation_id: 131566347
# Credentials — passed as `with:` inputs (composite actions
# cannot declare a `secrets:` block). At least one of
# anthropic_api_key or claude_code_oauth_token must be set;
# both is fine — API is tried first, OAuth is fallback.
app_id: ${{ secrets.GATEWAY_APP_ID }}
private_key: ${{ secrets.GATEWAY_PRIVATE_KEY }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

View file

@ -8,11 +8,6 @@ on:
branches:
- "*"
concurrency:
# Cancel any previous workflows if they are from a PR or push.
group: ${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
@ -25,7 +20,8 @@ env:
# If you change this value, please change it in the following files as well:
# /Dockerfile
GO_VERSION: 1.23.6
# /.golanlint-ci
GO_VERSION: 1.19.4
jobs:
########################
@ -80,7 +76,7 @@ jobs:
fetch-depth: 0
- name: go cache
uses: actions/cache@v4
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
@ -117,7 +113,7 @@ jobs:
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v4
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}

View file

@ -1,6 +1,6 @@
run:
# timeout for analysis
timeout: 4m
deadline: 4m
linters-settings:
govet:
@ -20,9 +20,8 @@ linters-settings:
excludes:
- G402 # Look for bad TLS connection settings.
- G306 # Poor file permissions used when writing to a new file.
- G601 # Implicit memory aliasing in for loop.
- G115 # Integer overflow in conversion.
staticcheck:
go: "1.19"
checks: ["-SA1019"]
linters:
@ -62,20 +61,21 @@ linters:
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
- errorlint
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
- interfacer
- golint
- maligned
- scopelint
- varcheck
- structcheck
- deadcode
# gRPC needs snake case notation.
- nosnakecase
# New linters that need a code adjustment first.
- intrange
- revive
- gosmopolitan
- goconst
- copyloopvar
- wrapcheck
- depguard
- inamedparam
- protogetter
- perfsprint
- tagalign
- testifylint
- nolintlint
- paralleltest
- tparallel
@ -90,8 +90,11 @@ linters:
- containedctx
- contextcheck
- errname
- exhaustivestruct
- exhaustruct
- err113
- goerr113
- gomnd
- ifshort
- noctx
- nestif
- wsl
@ -108,14 +111,7 @@ linters:
- forbidigo
- interfacebloat
# The linter is too aggressive and doesn't add much value since reviewers
# will also catch magic numbers that make sense to extract.
- mnd
issues:
# Only show newly introduced problems.
new-from-rev: c5b37702e0bead2408ba72aad792ea4ff9fc930f
exclude-rules:
# Exclude gosec from running for tests so that tests with weak randomness
# (math/rand) will pass the linter.

View file

@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM} golang:1.23.6-alpine as builder
FROM --platform=${BUILDPLATFORM} golang:1.19.4-alpine as builder
# Force Go to use the cgo based DNS resolver. This is required to ensure DNS
# queries required to connect to linked containers succeed.

View file

@ -73,8 +73,8 @@ build:
install:
@$(call print, "Installing Pool.")
$(GOINSTALL) -tags="${tags}" -ldflags="$(LDFLAGS)" $(PKG)/cmd/pool
$(GOINSTALL) -tags="${tags}" -ldflags="$(LDFLAGS)" $(PKG)/cmd/poold
$(GOINSTALL) -ldflags="$(LDFLAGS)" $(PKG)/cmd/pool
$(GOINSTALL) -ldflags="$(LDFLAGS)" $(PKG)/cmd/poold
release:
@$(call print, "Releasing pool and poold binaries.")

View file

@ -568,7 +568,7 @@ func (o *OutputWithFee) CloseOutputs(accountValue btcutil.Amount,
)
}
fee := o.FeeRate.FeeForWeight(weightEstimator.Weight())
fee := o.FeeRate.FeeForWeight(int64(weightEstimator.Weight()))
outputValue := accountValue - fee
if outputValue < dustLimit {
return nil, fmt.Errorf("closing to output %x with %v results "+

View file

@ -1,7 +1,7 @@
package account
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightninglabs/pool/account/watcher"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -33,7 +33,6 @@ import (
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/verrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
@ -97,7 +96,7 @@ func (wt witnessType) scriptVersion() poolscript.Version {
}
// witnessSize returns the estimated weight units for an account input witness.
func (wt witnessType) witnessSize() (lntypes.WeightUnit, error) {
func (wt witnessType) witnessSize() (int, error) {
switch wt {
case expiryWitness:
return poolscript.ExpiryWitnessSize, nil
@ -2153,7 +2152,7 @@ func valueAfterAccountUpdate(account *Account, outputs []*wire.TxOut,
// With the weight estimated, compute the fee, which we'll then subtract
// from our input total and ensure our new account value isn't below our
// required minimum.
fee := feeRate.FeeForWeight(weightEstimator.Weight())
fee := feeRate.FeeForWeight(int64(weightEstimator.Weight()))
newAccountValue := account.Value - outputTotal - fee
if newAccountValue < MinAccountValue {
return 0, fmt.Errorf("new account value is below accepted "+
@ -2185,7 +2184,8 @@ func (m *manager) inputsForDeposit(ctx context.Context, account *Account,
return nil, nil, err
}
acctInputEstimator.AddWitnessInput(witnessSize)
acctInputFee := feeRate.FeeForWeight(acctInputEstimator.Weight())
acctInputWeight := int64(acctInputEstimator.Weight())
acctInputFee := feeRate.FeeForWeight(acctInputWeight)
outputToFund := &wire.TxOut{
Value: int64(depositAmount + acctInputFee),
@ -2425,9 +2425,7 @@ func sanityCheckAccountSpendTx(account *Account, packet *psbt.Packet,
// flag fields that weren't counted above because the unsigned TX has no
// witness.
fullWeight := txWeightNoWitness + 2 + witnessSize
minRelayFee := chainfee.FeePerKwFloor.FeeForWeight(
lntypes.WeightUnit(fullWeight),
)
minRelayFee := chainfee.FeePerKwFloor.FeeForWeight(fullWeight)
if feesPaid < minRelayFee {
return fmt.Errorf("signed transaction only pays %d sats "+
"in fees while %d are required for relay", feesPaid,

View file

@ -89,7 +89,6 @@ type testHarness struct {
store *mockStore
notifier *mockChainNotifier
wallet *mockWallet
signer *mockSigner
auctioneer *mockAuctioneer
manager Manager
}
@ -97,7 +96,6 @@ type testHarness struct {
func newTestHarness(t *testing.T) *testHarness {
store := newMockStore()
wallet := newMockWallet()
signer := newMockSigner()
notifier := newMockChainNotifier()
auctioneer := newMockAuctioneer()
@ -105,14 +103,13 @@ func newTestHarness(t *testing.T) *testHarness {
t: t,
store: store,
wallet: wallet,
signer: signer,
notifier: notifier,
auctioneer: auctioneer,
manager: NewManager(&ManagerConfig{
Store: store,
Auctioneer: auctioneer,
Wallet: wallet,
Signer: signer,
Signer: wallet,
ChainNotifier: notifier,
TxSource: wallet,
TxFeeEstimator: wallet,
@ -422,14 +419,14 @@ func (h *testHarness) assertAuctioneerMuSig2NoncesReceived() {
h.auctioneer.mu.Lock()
defer h.auctioneer.mu.Unlock()
h.signer.Lock()
defer h.signer.Unlock()
h.wallet.Lock()
defer h.wallet.Unlock()
require.Len(h.t, h.signer.muSig2Sessions, 0)
require.Len(h.t, h.signer.muSig2RemovedSessions, 1)
require.Len(h.t, h.wallet.muSig2Sessions, 0)
require.Len(h.t, h.wallet.muSig2RemovedSessions, 1)
var sessionInfo *input.MuSig2SessionInfo
for _, info := range h.signer.muSig2RemovedSessions {
for _, info := range h.wallet.muSig2RemovedSessions {
sessionInfo = info
break
}

View file

@ -1,10 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: account/interfaces.go
//
// Generated by this command:
//
// mockgen -source=account/interfaces.go -package=account -destination=account/mock_interfaces.go
//
// Package account is a generated GoMock package.
package account
@ -13,16 +8,16 @@ import (
context "context"
reflect "reflect"
btcec "github.com/btcsuite/btcd/btcec/v2"
v2 "github.com/btcsuite/btcd/btcec/v2"
btcutil "github.com/btcsuite/btcd/btcutil"
wire "github.com/btcsuite/btcd/wire"
wtxmgr "github.com/btcsuite/btcwallet/wtxmgr"
gomock "github.com/golang/mock/gomock"
lndclient "github.com/lightninglabs/lndclient"
terms "github.com/lightninglabs/pool/terms"
chainntnfs "github.com/lightningnetwork/lnd/chainntnfs"
keychain "github.com/lightningnetwork/lnd/keychain"
chainfee "github.com/lightningnetwork/lnd/lnwallet/chainfee"
gomock "go.uber.org/mock/gomock"
)
// MockStore is a mock of Store interface.
@ -49,7 +44,7 @@ func (m *MockStore) EXPECT() *MockStoreMockRecorder {
}
// Account mocks base method.
func (m *MockStore) Account(arg0 *btcec.PublicKey) (*Account, error) {
func (m *MockStore) Account(arg0 *v2.PublicKey) (*Account, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Account", arg0)
ret0, _ := ret[0].(*Account)
@ -58,7 +53,7 @@ func (m *MockStore) Account(arg0 *btcec.PublicKey) (*Account, error) {
}
// Account indicates an expected call of Account.
func (mr *MockStoreMockRecorder) Account(arg0 any) *gomock.Call {
func (mr *MockStoreMockRecorder) Account(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Account", reflect.TypeOf((*MockStore)(nil).Account), arg0)
}
@ -87,7 +82,7 @@ func (m *MockStore) AddAccount(arg0 *Account) error {
}
// AddAccount indicates an expected call of AddAccount.
func (mr *MockStoreMockRecorder) AddAccount(arg0 any) *gomock.Call {
func (mr *MockStoreMockRecorder) AddAccount(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAccount", reflect.TypeOf((*MockStore)(nil).AddAccount), arg0)
}
@ -138,7 +133,7 @@ func (mr *MockStoreMockRecorder) PendingBatch() *gomock.Call {
// UpdateAccount mocks base method.
func (m *MockStore) UpdateAccount(arg0 *Account, arg1 ...Modifier) error {
m.ctrl.T.Helper()
varargs := []any{arg0}
varargs := []interface{}{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
@ -148,9 +143,9 @@ func (m *MockStore) UpdateAccount(arg0 *Account, arg1 ...Modifier) error {
}
// UpdateAccount indicates an expected call of UpdateAccount.
func (mr *MockStoreMockRecorder) UpdateAccount(arg0 any, arg1 ...any) *gomock.Call {
func (mr *MockStoreMockRecorder) UpdateAccount(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{arg0}, arg1...)
varargs := append([]interface{}{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccount", reflect.TypeOf((*MockStore)(nil).UpdateAccount), varargs...)
}
@ -186,7 +181,7 @@ func (m *MockAuctioneer) InitAccount(arg0 context.Context, arg1 *Account) error
}
// InitAccount indicates an expected call of InitAccount.
func (mr *MockAuctioneerMockRecorder) InitAccount(arg0, arg1 any) *gomock.Call {
func (mr *MockAuctioneerMockRecorder) InitAccount(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitAccount", reflect.TypeOf((*MockAuctioneer)(nil).InitAccount), arg0, arg1)
}
@ -202,13 +197,13 @@ func (m *MockAuctioneer) ModifyAccount(ctx context.Context, acct *Account, input
}
// ModifyAccount indicates an expected call of ModifyAccount.
func (mr *MockAuctioneerMockRecorder) ModifyAccount(ctx, acct, inputs, outputs, modifiers, traderNonces, previousOutputs any) *gomock.Call {
func (mr *MockAuctioneerMockRecorder) ModifyAccount(ctx, acct, inputs, outputs, modifiers, traderNonces, previousOutputs interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ModifyAccount", reflect.TypeOf((*MockAuctioneer)(nil).ModifyAccount), ctx, acct, inputs, outputs, modifiers, traderNonces, previousOutputs)
}
// ReserveAccount mocks base method.
func (m *MockAuctioneer) ReserveAccount(arg0 context.Context, arg1 btcutil.Amount, arg2 uint32, arg3 *btcec.PublicKey, arg4 Version) (*Reservation, error) {
func (m *MockAuctioneer) ReserveAccount(arg0 context.Context, arg1 btcutil.Amount, arg2 uint32, arg3 *v2.PublicKey, arg4 Version) (*Reservation, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ReserveAccount", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(*Reservation)
@ -217,7 +212,7 @@ func (m *MockAuctioneer) ReserveAccount(arg0 context.Context, arg1 btcutil.Amoun
}
// ReserveAccount indicates an expected call of ReserveAccount.
func (mr *MockAuctioneerMockRecorder) ReserveAccount(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call {
func (mr *MockAuctioneerMockRecorder) ReserveAccount(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReserveAccount", reflect.TypeOf((*MockAuctioneer)(nil).ReserveAccount), arg0, arg1, arg2, arg3, arg4)
}
@ -231,7 +226,7 @@ func (m *MockAuctioneer) StartAccountSubscription(arg0 context.Context, arg1 *ke
}
// StartAccountSubscription indicates an expected call of StartAccountSubscription.
func (mr *MockAuctioneerMockRecorder) StartAccountSubscription(arg0, arg1 any) *gomock.Call {
func (mr *MockAuctioneerMockRecorder) StartAccountSubscription(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartAccountSubscription", reflect.TypeOf((*MockAuctioneer)(nil).StartAccountSubscription), arg0, arg1)
}
@ -246,7 +241,7 @@ func (m *MockAuctioneer) Terms(ctx context.Context) (*terms.AuctioneerTerms, err
}
// Terms indicates an expected call of Terms.
func (mr *MockAuctioneerMockRecorder) Terms(ctx any) *gomock.Call {
func (mr *MockAuctioneerMockRecorder) Terms(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Terms", reflect.TypeOf((*MockAuctioneer)(nil).Terms), ctx)
}
@ -277,7 +272,7 @@ func (m *MockTxSource) EXPECT() *MockTxSourceMockRecorder {
// ListTransactions mocks base method.
func (m *MockTxSource) ListTransactions(ctx context.Context, startHeight, endHeight int32, opts ...lndclient.ListTransactionsOption) ([]lndclient.Transaction, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, startHeight, endHeight}
varargs := []interface{}{ctx, startHeight, endHeight}
for _, a := range opts {
varargs = append(varargs, a)
}
@ -288,9 +283,9 @@ func (m *MockTxSource) ListTransactions(ctx context.Context, startHeight, endHei
}
// ListTransactions indicates an expected call of ListTransactions.
func (mr *MockTxSourceMockRecorder) ListTransactions(ctx, startHeight, endHeight any, opts ...any) *gomock.Call {
func (mr *MockTxSourceMockRecorder) ListTransactions(ctx, startHeight, endHeight interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, startHeight, endHeight}, opts...)
varargs := append([]interface{}{ctx, startHeight, endHeight}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTransactions", reflect.TypeOf((*MockTxSource)(nil).ListTransactions), varargs...)
}
@ -327,7 +322,7 @@ func (m *MockTxFeeEstimator) EstimateFeeToP2WSH(ctx context.Context, amt btcutil
}
// EstimateFeeToP2WSH indicates an expected call of EstimateFeeToP2WSH.
func (mr *MockTxFeeEstimatorMockRecorder) EstimateFeeToP2WSH(ctx, amt, confTarget any) *gomock.Call {
func (mr *MockTxFeeEstimatorMockRecorder) EstimateFeeToP2WSH(ctx, amt, confTarget interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateFeeToP2WSH", reflect.TypeOf((*MockTxFeeEstimator)(nil).EstimateFeeToP2WSH), ctx, amt, confTarget)
}
@ -365,7 +360,7 @@ func (m *MockFeeExpr) CloseOutputs(arg0 btcutil.Amount, arg1 witnessType) ([]*wi
}
// CloseOutputs indicates an expected call of CloseOutputs.
func (mr *MockFeeExprMockRecorder) CloseOutputs(arg0, arg1 any) *gomock.Call {
func (mr *MockFeeExprMockRecorder) CloseOutputs(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseOutputs", reflect.TypeOf((*MockFeeExpr)(nil).CloseOutputs), arg0, arg1)
}
@ -394,7 +389,7 @@ func (m *MockManager) EXPECT() *MockManagerMockRecorder {
}
// BumpAccountFee mocks base method.
func (m *MockManager) BumpAccountFee(ctx context.Context, traderKey *btcec.PublicKey, newFeeRate chainfee.SatPerKWeight) error {
func (m *MockManager) BumpAccountFee(ctx context.Context, traderKey *v2.PublicKey, newFeeRate chainfee.SatPerKWeight) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "BumpAccountFee", ctx, traderKey, newFeeRate)
ret0, _ := ret[0].(error)
@ -402,13 +397,13 @@ func (m *MockManager) BumpAccountFee(ctx context.Context, traderKey *btcec.Publi
}
// BumpAccountFee indicates an expected call of BumpAccountFee.
func (mr *MockManagerMockRecorder) BumpAccountFee(ctx, traderKey, newFeeRate any) *gomock.Call {
func (mr *MockManagerMockRecorder) BumpAccountFee(ctx, traderKey, newFeeRate interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BumpAccountFee", reflect.TypeOf((*MockManager)(nil).BumpAccountFee), ctx, traderKey, newFeeRate)
}
// CloseAccount mocks base method.
func (m *MockManager) CloseAccount(ctx context.Context, traderKey *btcec.PublicKey, feeExpr FeeExpr, bestHeight uint32) (*wire.MsgTx, error) {
func (m *MockManager) CloseAccount(ctx context.Context, traderKey *v2.PublicKey, feeExpr FeeExpr, bestHeight uint32) (*wire.MsgTx, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CloseAccount", ctx, traderKey, feeExpr, bestHeight)
ret0, _ := ret[0].(*wire.MsgTx)
@ -417,13 +412,13 @@ func (m *MockManager) CloseAccount(ctx context.Context, traderKey *btcec.PublicK
}
// CloseAccount indicates an expected call of CloseAccount.
func (mr *MockManagerMockRecorder) CloseAccount(ctx, traderKey, feeExpr, bestHeight any) *gomock.Call {
func (mr *MockManagerMockRecorder) CloseAccount(ctx, traderKey, feeExpr, bestHeight interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseAccount", reflect.TypeOf((*MockManager)(nil).CloseAccount), ctx, traderKey, feeExpr, bestHeight)
}
// DepositAccount mocks base method.
func (m *MockManager) DepositAccount(ctx context.Context, traderKey *btcec.PublicKey, depositAmount btcutil.Amount, feeRate chainfee.SatPerKWeight, bestHeight, expiryHeight uint32, newVersion Version) (*Account, *wire.MsgTx, error) {
func (m *MockManager) DepositAccount(ctx context.Context, traderKey *v2.PublicKey, depositAmount btcutil.Amount, feeRate chainfee.SatPerKWeight, bestHeight, expiryHeight uint32, newVersion Version) (*Account, *wire.MsgTx, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DepositAccount", ctx, traderKey, depositAmount, feeRate, bestHeight, expiryHeight, newVersion)
ret0, _ := ret[0].(*Account)
@ -433,13 +428,13 @@ func (m *MockManager) DepositAccount(ctx context.Context, traderKey *btcec.Publi
}
// DepositAccount indicates an expected call of DepositAccount.
func (mr *MockManagerMockRecorder) DepositAccount(ctx, traderKey, depositAmount, feeRate, bestHeight, expiryHeight, newVersion any) *gomock.Call {
func (mr *MockManagerMockRecorder) DepositAccount(ctx, traderKey, depositAmount, feeRate, bestHeight, expiryHeight, newVersion interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DepositAccount", reflect.TypeOf((*MockManager)(nil).DepositAccount), ctx, traderKey, depositAmount, feeRate, bestHeight, expiryHeight, newVersion)
}
// HandleAccountConf mocks base method.
func (m *MockManager) HandleAccountConf(traderKey *btcec.PublicKey, confDetails *chainntnfs.TxConfirmation) error {
func (m *MockManager) HandleAccountConf(traderKey *v2.PublicKey, confDetails *chainntnfs.TxConfirmation) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HandleAccountConf", traderKey, confDetails)
ret0, _ := ret[0].(error)
@ -447,13 +442,13 @@ func (m *MockManager) HandleAccountConf(traderKey *btcec.PublicKey, confDetails
}
// HandleAccountConf indicates an expected call of HandleAccountConf.
func (mr *MockManagerMockRecorder) HandleAccountConf(traderKey, confDetails any) *gomock.Call {
func (mr *MockManagerMockRecorder) HandleAccountConf(traderKey, confDetails interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAccountConf", reflect.TypeOf((*MockManager)(nil).HandleAccountConf), traderKey, confDetails)
}
// HandleAccountExpiry mocks base method.
func (m *MockManager) HandleAccountExpiry(traderKey *btcec.PublicKey, height uint32) error {
func (m *MockManager) HandleAccountExpiry(traderKey *v2.PublicKey, height uint32) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HandleAccountExpiry", traderKey, height)
ret0, _ := ret[0].(error)
@ -461,13 +456,13 @@ func (m *MockManager) HandleAccountExpiry(traderKey *btcec.PublicKey, height uin
}
// HandleAccountExpiry indicates an expected call of HandleAccountExpiry.
func (mr *MockManagerMockRecorder) HandleAccountExpiry(traderKey, height any) *gomock.Call {
func (mr *MockManagerMockRecorder) HandleAccountExpiry(traderKey, height interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAccountExpiry", reflect.TypeOf((*MockManager)(nil).HandleAccountExpiry), traderKey, height)
}
// HandleAccountSpend mocks base method.
func (m *MockManager) HandleAccountSpend(traderKey *btcec.PublicKey, spendDetails *chainntnfs.SpendDetail) error {
func (m *MockManager) HandleAccountSpend(traderKey *v2.PublicKey, spendDetails *chainntnfs.SpendDetail) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HandleAccountSpend", traderKey, spendDetails)
ret0, _ := ret[0].(error)
@ -475,7 +470,7 @@ func (m *MockManager) HandleAccountSpend(traderKey *btcec.PublicKey, spendDetail
}
// HandleAccountSpend indicates an expected call of HandleAccountSpend.
func (mr *MockManagerMockRecorder) HandleAccountSpend(traderKey, spendDetails any) *gomock.Call {
func (mr *MockManagerMockRecorder) HandleAccountSpend(traderKey, spendDetails interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAccountSpend", reflect.TypeOf((*MockManager)(nil).HandleAccountSpend), traderKey, spendDetails)
}
@ -490,7 +485,7 @@ func (m *MockManager) InitAccount(ctx context.Context, value btcutil.Amount, ver
}
// InitAccount indicates an expected call of InitAccount.
func (mr *MockManagerMockRecorder) InitAccount(ctx, value, version, feeRate, expiry, bestHeight any) *gomock.Call {
func (mr *MockManagerMockRecorder) InitAccount(ctx, value, version, feeRate, expiry, bestHeight interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitAccount", reflect.TypeOf((*MockManager)(nil).InitAccount), ctx, value, version, feeRate, expiry, bestHeight)
}
@ -506,7 +501,7 @@ func (m *MockManager) QuoteAccount(ctx context.Context, value btcutil.Amount, co
}
// QuoteAccount indicates an expected call of QuoteAccount.
func (mr *MockManagerMockRecorder) QuoteAccount(ctx, value, confTarget any) *gomock.Call {
func (mr *MockManagerMockRecorder) QuoteAccount(ctx, value, confTarget interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QuoteAccount", reflect.TypeOf((*MockManager)(nil).QuoteAccount), ctx, value, confTarget)
}
@ -520,13 +515,13 @@ func (m *MockManager) RecoverAccount(ctx context.Context, account *Account) erro
}
// RecoverAccount indicates an expected call of RecoverAccount.
func (mr *MockManagerMockRecorder) RecoverAccount(ctx, account any) *gomock.Call {
func (mr *MockManagerMockRecorder) RecoverAccount(ctx, account interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecoverAccount", reflect.TypeOf((*MockManager)(nil).RecoverAccount), ctx, account)
}
// RenewAccount mocks base method.
func (m *MockManager) RenewAccount(ctx context.Context, traderKey *btcec.PublicKey, newExpiry uint32, feeRate chainfee.SatPerKWeight, bestHeight uint32, newVersion Version) (*Account, *wire.MsgTx, error) {
func (m *MockManager) RenewAccount(ctx context.Context, traderKey *v2.PublicKey, newExpiry uint32, feeRate chainfee.SatPerKWeight, bestHeight uint32, newVersion Version) (*Account, *wire.MsgTx, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RenewAccount", ctx, traderKey, newExpiry, feeRate, bestHeight, newVersion)
ret0, _ := ret[0].(*Account)
@ -536,7 +531,7 @@ func (m *MockManager) RenewAccount(ctx context.Context, traderKey *btcec.PublicK
}
// RenewAccount indicates an expected call of RenewAccount.
func (mr *MockManagerMockRecorder) RenewAccount(ctx, traderKey, newExpiry, feeRate, bestHeight, newVersion any) *gomock.Call {
func (mr *MockManagerMockRecorder) RenewAccount(ctx, traderKey, newExpiry, feeRate, bestHeight, newVersion interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RenewAccount", reflect.TypeOf((*MockManager)(nil).RenewAccount), ctx, traderKey, newExpiry, feeRate, bestHeight, newVersion)
}
@ -568,7 +563,7 @@ func (mr *MockManagerMockRecorder) Stop() *gomock.Call {
}
// WatchMatchedAccounts mocks base method.
func (m *MockManager) WatchMatchedAccounts(ctx context.Context, matchedAccounts []*btcec.PublicKey) error {
func (m *MockManager) WatchMatchedAccounts(ctx context.Context, matchedAccounts []*v2.PublicKey) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WatchMatchedAccounts", ctx, matchedAccounts)
ret0, _ := ret[0].(error)
@ -576,13 +571,13 @@ func (m *MockManager) WatchMatchedAccounts(ctx context.Context, matchedAccounts
}
// WatchMatchedAccounts indicates an expected call of WatchMatchedAccounts.
func (mr *MockManagerMockRecorder) WatchMatchedAccounts(ctx, matchedAccounts any) *gomock.Call {
func (mr *MockManagerMockRecorder) WatchMatchedAccounts(ctx, matchedAccounts interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WatchMatchedAccounts", reflect.TypeOf((*MockManager)(nil).WatchMatchedAccounts), ctx, matchedAccounts)
}
// WithdrawAccount mocks base method.
func (m *MockManager) WithdrawAccount(ctx context.Context, traderKey *btcec.PublicKey, outputs []*wire.TxOut, feeRate chainfee.SatPerKWeight, bestHeight, expiryHeight uint32, newVersion Version) (*Account, *wire.MsgTx, error) {
func (m *MockManager) WithdrawAccount(ctx context.Context, traderKey *v2.PublicKey, outputs []*wire.TxOut, feeRate chainfee.SatPerKWeight, bestHeight, expiryHeight uint32, newVersion Version) (*Account, *wire.MsgTx, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WithdrawAccount", ctx, traderKey, outputs, feeRate, bestHeight, expiryHeight, newVersion)
ret0, _ := ret[0].(*Account)
@ -592,7 +587,7 @@ func (m *MockManager) WithdrawAccount(ctx context.Context, traderKey *btcec.Publ
}
// WithdrawAccount indicates an expected call of WithdrawAccount.
func (mr *MockManagerMockRecorder) WithdrawAccount(ctx, traderKey, outputs, feeRate, bestHeight, expiryHeight, newVersion any) *gomock.Call {
func (mr *MockManagerMockRecorder) WithdrawAccount(ctx, traderKey, outputs, feeRate, bestHeight, expiryHeight, newVersion interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithdrawAccount", reflect.TypeOf((*MockManager)(nil).WithdrawAccount), ctx, traderKey, outputs, feeRate, bestHeight, expiryHeight, newVersion)
}

View file

@ -25,7 +25,6 @@ import (
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnrpc/chainrpc"
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
"github.com/lightningnetwork/lnd/lnwallet"
@ -240,12 +239,16 @@ var _ Auctioneer = (*mockAuctioneer)(nil)
type mockWallet struct {
TxSource
lndclient.WalletKitClient
lndclient.SignerClient
sync.Mutex
txs []lndclient.Transaction
publishChan chan *wire.MsgTx
utxos []*lnwallet.Utxo
fundPsbt *psbt.Packet
fundPsbtChangeIdx int32
txs []lndclient.Transaction
publishChan chan *wire.MsgTx
muSig2Sessions map[input.MuSig2SessionID]*input.MuSig2SessionInfo
muSig2RemovedSessions map[input.MuSig2SessionID]*input.MuSig2SessionInfo
utxos []*lnwallet.Utxo
fundPsbt *psbt.Packet
fundPsbtChangeIdx int32
sendOutputs func(context.Context, []*wire.TxOut,
chainfee.SatPerKWeight) (*wire.MsgTx, error)
@ -256,22 +259,28 @@ var _ lndclient.WalletKitClient = (*mockWallet)(nil)
func newMockWallet() *mockWallet {
return &mockWallet{
publishChan: make(chan *wire.MsgTx, 1),
muSig2Sessions: make(
map[input.MuSig2SessionID]*input.MuSig2SessionInfo,
),
muSig2RemovedSessions: make(
map[input.MuSig2SessionID]*input.MuSig2SessionInfo,
),
}
}
func (w *mockWallet) RawClientWithMacAuth(
ctx context.Context) (context.Context, time.Duration,
walletrpc.WalletKitClient) {
return ctx, 0, nil
}
func (w *mockWallet) DeriveNextKey(ctx context.Context,
family int32) (*keychain.KeyDescriptor, error) {
return testTraderKeyDesc, nil
}
func (w *mockWallet) DeriveSharedKey(ctx context.Context,
ephemeralKey *btcec.PublicKey,
keyLocator *keychain.KeyLocator) ([32]byte, error) {
return sharedSecret, nil
}
func (w *mockWallet) PublishTransaction(ctx context.Context, tx *wire.MsgTx,
label string) error {
@ -339,6 +348,24 @@ func (w *mockWallet) ReleaseOutput(_ context.Context, lockID wtxmgr.LockID,
return nil
}
func (w *mockWallet) SignOutputRaw(context.Context, *wire.MsgTx,
[]*lndclient.SignDescriptor, []*wire.TxOut) ([][]byte, error) {
return [][]byte{[]byte("trader sig")}, nil
}
func (w *mockWallet) ComputeInputScript(context.Context, *wire.MsgTx,
[]*lndclient.SignDescriptor, []*wire.TxOut) ([]*input.Script, error) {
return []*input.Script{{
SigScript: []byte("input sig script"),
Witness: wire.TxWitness{
[]byte("input"),
[]byte("witness"),
},
}}, nil
}
func (w *mockWallet) EstimateFeeRate(_ context.Context,
_ int32) (chainfee.SatPerKWeight, error) {
@ -375,7 +402,7 @@ func (w *mockWallet) SignPsbt(_ context.Context,
}
func (w *mockWallet) FinalizePsbt(_ context.Context, packet *psbt.Packet,
_ string) (*psbt.Packet, *wire.MsgTx, error) {
account string) (*psbt.Packet, *wire.MsgTx, error) {
// Just copy over any sigs we might have. This is copy/paste code from
// the psbt Finalizer, minus the IsComplete() check.
@ -419,55 +446,9 @@ func (w *mockWallet) FinalizePsbt(_ context.Context, packet *psbt.Packet,
return packet, packet.UnsignedTx, nil
}
type mockSigner struct {
lndclient.SignerClient
sync.Mutex
muSig2Sessions map[input.MuSig2SessionID]*input.MuSig2SessionInfo
muSig2RemovedSessions map[input.MuSig2SessionID]*input.MuSig2SessionInfo
}
var _ lndclient.SignerClient = (*mockSigner)(nil)
func newMockSigner() *mockSigner {
return &mockSigner{
muSig2Sessions: make(
map[input.MuSig2SessionID]*input.MuSig2SessionInfo,
),
muSig2RemovedSessions: make(
map[input.MuSig2SessionID]*input.MuSig2SessionInfo,
),
}
}
func (w *mockSigner) DeriveSharedKey(ctx context.Context,
ephemeralKey *btcec.PublicKey,
keyLocator *keychain.KeyLocator) ([32]byte, error) {
return sharedSecret, nil
}
func (w *mockSigner) SignOutputRaw(context.Context, *wire.MsgTx,
[]*lndclient.SignDescriptor, []*wire.TxOut) ([][]byte, error) {
return [][]byte{[]byte("trader sig")}, nil
}
func (w *mockSigner) ComputeInputScript(context.Context, *wire.MsgTx,
[]*lndclient.SignDescriptor, []*wire.TxOut) ([]*input.Script, error) {
return []*input.Script{{
SigScript: []byte("input sig script"),
Witness: wire.TxWitness{
[]byte("input"),
[]byte("witness"),
},
}}, nil
}
// MuSig2CreateSession creates a new musig session with the key and signers
// provided.
func (w *mockSigner) MuSig2CreateSession(_ context.Context,
func (w *mockWallet) MuSig2CreateSession(_ context.Context,
version input.MuSig2Version, _ *keychain.KeyLocator, _ [][]byte,
opts ...lndclient.MuSig2SessionOpts) (*input.MuSig2SessionInfo, error) {
@ -504,8 +485,8 @@ func (w *mockSigner) MuSig2CreateSession(_ context.Context,
// MuSig2RegisterNonces registers additional public nonces for a musig2 session.
// It returns a boolean indicating whether we have all of our nonces present.
func (w *mockSigner) MuSig2RegisterNonces(_ context.Context, _ [32]byte,
_ [][66]byte) (bool, error) {
func (w *mockWallet) MuSig2RegisterNonces(_ context.Context, sessionID [32]byte,
nonces [][66]byte) (bool, error) {
return true, nil
}
@ -514,7 +495,7 @@ func (w *mockSigner) MuSig2RegisterNonces(_ context.Context, _ [32]byte,
// message. This can only be called once all public nonces have been created. If
// the caller will not be responsible for combining the signatures, the cleanup
// bool should be set.
func (w *mockSigner) MuSig2Sign(_ context.Context, sessionID [32]byte,
func (w *mockWallet) MuSig2Sign(_ context.Context, sessionID [32]byte,
_ [32]byte, cleanup bool) ([]byte, error) {
var (
@ -540,7 +521,7 @@ func (w *mockSigner) MuSig2Sign(_ context.Context, sessionID [32]byte,
// MuSig2CombineSig combines the given partial signature(s) with the local one,
// if it already exists. Once a partial signature of all participants are
// registered, the final signature will be combined and returned.
func (w *mockSigner) MuSig2CombineSig(_ context.Context, sessionID [32]byte,
func (w *mockWallet) MuSig2CombineSig(_ context.Context, sessionID [32]byte,
_ [][]byte) (bool, []byte, error) {
var (
@ -563,7 +544,7 @@ func (w *mockSigner) MuSig2CombineSig(_ context.Context, sessionID [32]byte,
}
// MuSig2Cleanup removes a session from memory to free up resources.
func (w *mockSigner) MuSig2Cleanup(_ context.Context,
func (w *mockWallet) MuSig2Cleanup(_ context.Context,
sessionID [32]byte) error {
w.Lock()
@ -599,13 +580,6 @@ func newMockChainNotifier() *mockChainNotifier {
}
}
func (n *mockChainNotifier) RawClientWithMacAuth(
ctx context.Context) (context.Context, time.Duration,
chainrpc.ChainNotifierClient) {
return ctx, 0, nil
}
func (n *mockChainNotifier) RegisterConfirmationsNtfn(ctx context.Context,
txid *chainhash.Hash, pkScript []byte, numConfs, heightHint int32,
opts ...lndclient.NotifierOption) (chan *chainntnfs.TxConfirmation,

View file

@ -10,11 +10,11 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
gomock "github.com/golang/mock/gomock"
"github.com/lightninglabs/pool/internal/test"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
var (

View file

@ -1,7 +1,7 @@
package watcher
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -1,10 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: account/watcher/interfaces.go
//
// Generated by this command:
//
// mockgen -source=account/watcher/interfaces.go -package=watcher -destination=account/watcher/mock_interface_test.go
//
// Package watcher is a generated GoMock package.
package watcher
@ -15,8 +10,8 @@ import (
btcec "github.com/btcsuite/btcd/btcec/v2"
chainhash "github.com/btcsuite/btcd/chaincfg/chainhash"
wire "github.com/btcsuite/btcd/wire"
gomock "github.com/golang/mock/gomock"
chainntnfs "github.com/lightningnetwork/lnd/chainntnfs"
gomock "go.uber.org/mock/gomock"
)
// MockController is a mock of Controller interface.
@ -49,7 +44,7 @@ func (m *MockController) CancelAccountConf(traderKey *btcec.PublicKey) {
}
// CancelAccountConf indicates an expected call of CancelAccountConf.
func (mr *MockControllerMockRecorder) CancelAccountConf(traderKey any) *gomock.Call {
func (mr *MockControllerMockRecorder) CancelAccountConf(traderKey interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelAccountConf", reflect.TypeOf((*MockController)(nil).CancelAccountConf), traderKey)
}
@ -61,7 +56,7 @@ func (m *MockController) CancelAccountSpend(traderKey *btcec.PublicKey) {
}
// CancelAccountSpend indicates an expected call of CancelAccountSpend.
func (mr *MockControllerMockRecorder) CancelAccountSpend(traderKey any) *gomock.Call {
func (mr *MockControllerMockRecorder) CancelAccountSpend(traderKey interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelAccountSpend", reflect.TypeOf((*MockController)(nil).CancelAccountSpend), traderKey)
}
@ -101,7 +96,7 @@ func (m *MockController) WatchAccountConf(traderKey *btcec.PublicKey, txHash cha
}
// WatchAccountConf indicates an expected call of WatchAccountConf.
func (mr *MockControllerMockRecorder) WatchAccountConf(traderKey, txHash, script, numConfs, heightHint any) *gomock.Call {
func (mr *MockControllerMockRecorder) WatchAccountConf(traderKey, txHash, script, numConfs, heightHint interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WatchAccountConf", reflect.TypeOf((*MockController)(nil).WatchAccountConf), traderKey, txHash, script, numConfs, heightHint)
}
@ -113,7 +108,7 @@ func (m *MockController) WatchAccountExpiration(traderKey *btcec.PublicKey, expi
}
// WatchAccountExpiration indicates an expected call of WatchAccountExpiration.
func (mr *MockControllerMockRecorder) WatchAccountExpiration(traderKey, expiry any) *gomock.Call {
func (mr *MockControllerMockRecorder) WatchAccountExpiration(traderKey, expiry interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WatchAccountExpiration", reflect.TypeOf((*MockController)(nil).WatchAccountExpiration), traderKey, expiry)
}
@ -127,7 +122,7 @@ func (m *MockController) WatchAccountSpend(traderKey *btcec.PublicKey, accountPo
}
// WatchAccountSpend indicates an expected call of WatchAccountSpend.
func (mr *MockControllerMockRecorder) WatchAccountSpend(traderKey, accountPoint, script, heightHint any) *gomock.Call {
func (mr *MockControllerMockRecorder) WatchAccountSpend(traderKey, accountPoint, script, heightHint interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WatchAccountSpend", reflect.TypeOf((*MockController)(nil).WatchAccountSpend), traderKey, accountPoint, script, heightHint)
}
@ -164,7 +159,7 @@ func (m *MockEventHandler) HandleAccountConf(arg0 *btcec.PublicKey, arg1 *chainn
}
// HandleAccountConf indicates an expected call of HandleAccountConf.
func (mr *MockEventHandlerMockRecorder) HandleAccountConf(arg0, arg1 any) *gomock.Call {
func (mr *MockEventHandlerMockRecorder) HandleAccountConf(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAccountConf", reflect.TypeOf((*MockEventHandler)(nil).HandleAccountConf), arg0, arg1)
}
@ -178,7 +173,7 @@ func (m *MockEventHandler) HandleAccountExpiry(arg0 *btcec.PublicKey, arg1 uint3
}
// HandleAccountExpiry indicates an expected call of HandleAccountExpiry.
func (mr *MockEventHandlerMockRecorder) HandleAccountExpiry(arg0, arg1 any) *gomock.Call {
func (mr *MockEventHandlerMockRecorder) HandleAccountExpiry(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAccountExpiry", reflect.TypeOf((*MockEventHandler)(nil).HandleAccountExpiry), arg0, arg1)
}
@ -192,7 +187,7 @@ func (m *MockEventHandler) HandleAccountSpend(arg0 *btcec.PublicKey, arg1 *chain
}
// HandleAccountSpend indicates an expected call of HandleAccountSpend.
func (mr *MockEventHandlerMockRecorder) HandleAccountSpend(arg0, arg1 any) *gomock.Call {
func (mr *MockEventHandlerMockRecorder) HandleAccountSpend(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAccountSpend", reflect.TypeOf((*MockEventHandler)(nil).HandleAccountSpend), arg0, arg1)
}
@ -227,7 +222,7 @@ func (m *MockExpiryWatcher) AddAccountExpiration(traderKey *btcec.PublicKey, exp
}
// AddAccountExpiration indicates an expected call of AddAccountExpiration.
func (mr *MockExpiryWatcherMockRecorder) AddAccountExpiration(traderKey, expiry any) *gomock.Call {
func (mr *MockExpiryWatcherMockRecorder) AddAccountExpiration(traderKey, expiry interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAccountExpiration", reflect.TypeOf((*MockExpiryWatcher)(nil).AddAccountExpiration), traderKey, expiry)
}
@ -239,7 +234,7 @@ func (m *MockExpiryWatcher) NewBlock(bestHeight uint32) {
}
// NewBlock indicates an expected call of NewBlock.
func (mr *MockExpiryWatcherMockRecorder) NewBlock(bestHeight any) *gomock.Call {
func (mr *MockExpiryWatcherMockRecorder) NewBlock(bestHeight interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBlock", reflect.TypeOf((*MockExpiryWatcher)(nil).NewBlock), bestHeight)
}

View file

@ -9,7 +9,7 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
secp "github.com/decred/dcrd/dcrec/secp256k1/v4"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
func randomPrivateKey(seed int64) *btcec.PrivateKey {
@ -26,13 +26,13 @@ func randomPublicKey(seed int64) *btcec.PublicKey {
return key.PubKey()
}
// func randomAccountKey(seed int64) [33]byte {
// var accountKey [33]byte
//
// key := randomPublicKey(seed)
// copy(accountKey[:], key.SerializeCompressed())
// return accountKey
// }
func randomAccountKey(seed int64) [33]byte {
var accountKey [33]byte
key := randomPublicKey(seed)
copy(accountKey[:], key.SerializeCompressed())
return accountKey
}
var overdueExpirationsTestCases = []struct {
name string
@ -42,54 +42,51 @@ var overdueExpirationsTestCases = []struct {
handledExpirations []*btcec.PublicKey
checks []func(watcher *expiryWatcher) error
}{{
// TODO(guggero): Find out why some tests in this file are suddenly
// failing after upgrading to lnd 0.18.0 (maybe the now required Go
// version?).
// name: "overdue expirations are handled properly",
// blockHeight: 24,
// expirations: map[[33]byte]uint32{
// randomAccountKey(0): 24,
// randomAccountKey(1): 24,
// randomAccountKey(2): 24,
// randomAccountKey(3): 27,
// },
// handledExpirations: []*btcec.PublicKey{
// randomPublicKey(0),
// randomPublicKey(1),
// randomPublicKey(2),
// },
// expirationsPerHeight: map[uint32][]*btcec.PublicKey{
// 24: {
// randomPublicKey(0),
// randomPublicKey(1),
// randomPublicKey(2),
// },
// 27: {
// randomPublicKey(27),
// },
// },
// checks: []func(watcher *expiryWatcher) error{
// func(watcher *expiryWatcher) error {
// left := watcher.expirationsPerHeight[24]
// if len(left) != 0 {
// return errors.New(
// "expirations were not " +
// "handled properly",
// )
// }
// return nil
// },
// func(watcher *expiryWatcher) error {
// if len(watcher.expirations) != 1 {
// return errors.New(
// "handled expirations were " +
// "not deleted",
// )
// }
// return nil
// },
// },
// }, {
name: "overdue expirations are handled properly",
blockHeight: 24,
expirations: map[[33]byte]uint32{
randomAccountKey(0): 24,
randomAccountKey(1): 24,
randomAccountKey(2): 24,
randomAccountKey(3): 27,
},
handledExpirations: []*btcec.PublicKey{
randomPublicKey(0),
randomPublicKey(1),
randomPublicKey(2),
},
expirationsPerHeight: map[uint32][]*btcec.PublicKey{
24: {
randomPublicKey(0),
randomPublicKey(1),
randomPublicKey(2),
},
27: {
randomPublicKey(27),
},
},
checks: []func(watcher *expiryWatcher) error{
func(watcher *expiryWatcher) error {
left := watcher.expirationsPerHeight[24]
if len(left) != 0 {
return errors.New(
"expirations were not " +
"handled properly",
)
}
return nil
},
func(watcher *expiryWatcher) error {
if len(watcher.expirations) != 1 {
return errors.New(
"handled expirations were " +
"not deleted",
)
}
return nil
},
},
}, {
name: "if account wasn't track we ignore it",
blockHeight: 24,
expirationsPerHeight: map[uint32][]*btcec.PublicKey{
@ -116,7 +113,6 @@ func TestOverdueExpirations(t *testing.T) {
watcher.expirationsPerHeight = tc.expirationsPerHeight
for _, trader := range tc.handledExpirations {
trader := trader
handlers.EXPECT().
HandleAccountExpiry(
trader,
@ -179,31 +175,31 @@ var addAccountExpirationTestCases = []struct {
return nil
},
},
// }, {
// name: "adding an account that we are already watching",
// bestHeight: 20,
// initialExpirations: map[[33]byte]uint32{
// randomAccountKey(1): 25,
// },
// expirations: map[*btcec.PublicKey]uint32{
// randomPublicKey(1): 35,
// },
// handler: func(*btcec.PublicKey, uint32) error {
// return nil
// },
// checks: []func(watcher *expiryWatcher) error{
// func(watcher *expiryWatcher) error {
// msg := "account expiry was not updated"
// if len(watcher.expirationsPerHeight[35]) != 1 {
// return errors.New(msg)
// }
//
// if watcher.expirations[randomAccountKey(1)] != 35 {
// return errors.New(msg)
// }
// return nil
// },
// },
}, {
name: "adding an account that we are already watching",
bestHeight: 20,
initialExpirations: map[[33]byte]uint32{
randomAccountKey(1): 25,
},
expirations: map[*btcec.PublicKey]uint32{
randomPublicKey(1): 35,
},
handler: func(*btcec.PublicKey, uint32) error {
return nil
},
checks: []func(watcher *expiryWatcher) error{
func(watcher *expiryWatcher) error {
msg := "account expiry was not updated"
if len(watcher.expirationsPerHeight[35]) != 1 {
return errors.New(msg)
}
if watcher.expirations[randomAccountKey(1)] != 35 {
return errors.New(msg)
}
return nil
},
},
}}
func TestAddAccountExpiration(t *testing.T) {
@ -225,7 +221,6 @@ func TestAddAccountExpiration(t *testing.T) {
watcher.bestHeight = tc.bestHeight
for trader, height := range tc.expirations {
trader := trader
if height < tc.bestHeight {
handlers.EXPECT().
HandleAccountExpiry(

View file

@ -8,7 +8,6 @@ import (
"fmt"
"io"
"math"
"math/rand/v2"
"net"
"sync"
"sync/atomic"
@ -47,9 +46,12 @@ const (
)
var (
// ErrServerShutdown is the error that is returned if the auction server
// signals it's going to shut down.
ErrServerShutdown = errors.New("server shutting down")
// ErrServerErrored is the error that is returned if the auction server
// sends back an error instead of a proper message, or if the server
// stream is closed in a way that requires a reconnect.
// sends back an error instead of a proper message.
ErrServerErrored = errors.New("server sent unexpected error")
// ErrClientShutdown is the error that is returned if the trader client
@ -643,25 +645,6 @@ func (c *Client) connectAndAuthenticate(ctx context.Context,
c.subscribedAcctsMtx.Lock()
c.subscribedAccts[acctPubKey] = sub
c.subscribedAcctsMtx.Unlock()
// The subscription needs to be in the map before authenticate runs so
// that readIncomingStream can route the server's Challenge/Error
// responses back to it. But if the handshake doesn't reach the
// GetSuccess branch below, the entry is stale — a later subscribe
// attempt for the same account would hit the "already subscribed"
// guard at the top of this function and silently no-op without ever
// sending a fresh Commit. Clean up here so only genuinely live
// subscriptions remain in the map.
success := false
defer func() {
if success {
return
}
c.subscribedAcctsMtx.Lock()
delete(c.subscribedAccts, acctPubKey)
c.subscribedAcctsMtx.Unlock()
}()
err := sub.authenticate(ctx)
if err != nil {
log.Errorf("Authentication failed for account %x: %v",
@ -680,16 +663,6 @@ func (c *Client) connectAndAuthenticate(ctx context.Context,
// Ah, so it's the server shutting down, so let's re-
// try our connection.
if err == ErrServerErrored {
// HandleServerShutdown clears subscribedAccts
// and re-runs StartAccountSubscription for
// every previously-live account, including
// this one. That inner call installs a fresh
// entry in the map for acctPubKey. We must
// suppress our deferred cleanup so it doesn't
// turn around and delete that fresh entry on
// the way out, leaving the resubscribed
// account unreachable from sendToSubscription.
success = true
return sub, false, c.HandleServerShutdown(nil)
}
@ -708,11 +681,8 @@ func (c *Client) connectAndAuthenticate(ctx context.Context,
// Did the server find the account we're interested in?
switch {
// Account exists, everything's good to continue. This is the
// only path that keeps the subscription in the map; every
// other exit triggers the deferred cleanup above.
// Account exists, everything's good to continue.
case srvMsg.GetSuccess() != nil:
success = true
return sub, true, nil
// We got an error. If we're in recovery mode, this could either
@ -962,16 +932,6 @@ func (c *Client) IsSubscribed() bool {
return c.serverStream != nil
}
// jitterBackoff returns backoff with up to 25% additive jitter so reconnect
// attempts from a population of traders observing the same disconnect event
// fan out over a window rather than spike at one instant. The jitter is
// one-sided so we never wait less than the operator's configured floor.
//
//nolint:gosec // Backoff jitter doesn't need cryptographic randomness.
func jitterBackoff(backoff time.Duration) time.Duration {
return backoff + time.Duration(rand.Int64N(int64(backoff)/4+1))
}
// connectServerStream opens the initial connection to the server for the stream
// of account updates and handles reconnect trials with incremental backoff.
func (c *Client) connectServerStream(initialBackoff time.Duration,
@ -988,11 +948,8 @@ func (c *Client) connectServerStream(initialBackoff time.Duration,
)
for i := 0; i < numRetries; i++ {
// Wait before connecting in case this is a reconnect trial.
// Apply additive jitter so a population of traders that all
// hit the same disconnect event don't fan in on the server at
// exactly the same instant.
if backoff != 0 {
err = c.wait(jitterBackoff(backoff))
err = c.wait(backoff)
if err != nil {
return err
}
@ -1086,16 +1043,14 @@ func (c *Client) readIncomingStream() { // nolint:gocyclo
poolrpc.PrintMsg(msg), err)
switch {
// EOF means the server has cut its side of the stream cleanly.
// This happens on planned server shutdowns, but also on
// proxy/load-balancer idle timeouts or any other clean-close
// scenario where the underlying TCP connection may still be
// alive. In all cases the long-lived subscription is gone and
// we need to trigger a reconnect, so route this through the
// same error path as any other stream failure.
// EOF is the "normal" close signal, meaning the server has
// cut its side of the connection. We will only get this during
// the proper shutdown of the server where we already have a
// reconnect scheduled. On an improper shutdown, we'll get an
// error, usually "transport is closing".
case err == io.EOF:
select {
case c.errChanSwitch.ErrChan() <- ErrServerErrored:
case c.errChanSwitch.ErrChan() <- ErrServerShutdown:
case <-c.quit:
}
return
@ -1311,21 +1266,13 @@ func (c *Client) HandleServerShutdown(err error) error {
delete(c.subscribedAccts, key)
}
c.subscribedAcctsMtx.Unlock()
// Attempt every account even if some fail — bailing on the first
// error here would leave the remaining accounts silently
// un-subscribed and offline to the matchmaker until the next
// reconnect or process restart.
var errs []error
for _, acctKey := range acctKeys {
err := c.StartAccountSubscription(context.Background(), acctKey)
if err != nil {
log.Errorf("Failed to re-subscribe account %x: %v",
acctKey.PubKey.SerializeCompressed(), err)
errs = append(errs, err)
return err
}
}
return errors.Join(errs...)
return nil
}
// unmarshallServerAccount parses the account information sent from the

View file

@ -1,649 +0,0 @@
package auctioneer
import (
"bytes"
"context"
"errors"
"io"
"sync"
"testing"
"time"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/lightninglabs/pool/account"
"github.com/lightninglabs/pool/auctioneerrpc"
"github.com/lightninglabs/pool/clientdb"
"github.com/lightninglabs/pool/order"
"github.com/lightningnetwork/lnd/keychain"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// TestJitterBackoffBounds samples the jitter helper for a typical configured
// backoff and asserts results fall in the expected [backoff, backoff +
// backoff/4] range and aren't pinned to a single value.
func TestJitterBackoffBounds(t *testing.T) {
t.Parallel()
const (
base = 5 * time.Second
samples = 200
)
seen := make(map[time.Duration]struct{}, samples)
for i := 0; i < samples; i++ {
got := jitterBackoff(base)
if got < base || got > base+base/4 {
t.Fatalf("jitterBackoff(%v) = %v, out of [%v, %v]",
base, got, base, base+base/4)
}
seen[got] = struct{}{}
}
// In 200 samples over a 1.25s window of nanosecond resolution we
// expect many distinct values. If we get only a handful, jitter is
// broken.
if len(seen) < 10 {
t.Fatalf("expected diverse jitter samples, "+
"only got %d unique values", len(seen))
}
}
// fakeServerStream is a minimal implementation of
// ChannelAuctioneer_SubscribeBatchAuctionClient that returns predetermined
// results from Recv and captures client-sent messages on `sent` (when
// non-nil). It is only sufficient for driving the client's read loop and
// the auth handshake.
type fakeServerStream struct {
grpc.ClientStream
recv chan recvResult
sent chan *auctioneerrpc.ClientAuctionMessage
}
type recvResult struct {
msg *auctioneerrpc.ServerAuctionMessage
err error
}
func (s *fakeServerStream) Send(msg *auctioneerrpc.ClientAuctionMessage) error {
if s.sent != nil {
s.sent <- msg
}
return nil
}
func (s *fakeServerStream) Recv() (*auctioneerrpc.ServerAuctionMessage, error) {
r := <-s.recv
return r.msg, r.err
}
func (s *fakeServerStream) CloseSend() error {
return nil
}
// fakeAuctioneerClient embeds the real ChannelAuctioneerClient interface so it
// satisfies all 14 methods by nil-deref (none are called in this test other
// than the two we override below).
type fakeAuctioneerClient struct {
auctioneerrpc.ChannelAuctioneerClient
stream auctioneerrpc.ChannelAuctioneer_SubscribeBatchAuctionClient
}
func (f *fakeAuctioneerClient) Terms(ctx context.Context,
in *auctioneerrpc.TermsRequest,
opts ...grpc.CallOption) (*auctioneerrpc.TermsResponse, error) {
return &auctioneerrpc.TermsResponse{}, nil
}
func (f *fakeAuctioneerClient) SubscribeBatchAuction(ctx context.Context,
opts ...grpc.CallOption) (
auctioneerrpc.ChannelAuctioneer_SubscribeBatchAuctionClient, error) {
return f.stream, nil
}
// noPendingBatchSource is a BatchSource stub that always reports "no pending
// batch", letting checkPendingBatch return cleanly.
type noPendingBatchSource struct{}
func (noPendingBatchSource) PendingBatchSnapshot() (
*clientdb.LocalBatchSnapshot, error) {
return nil, account.ErrNoPendingBatch
}
// newTestClient returns a Client wired up just enough to drive
// readIncomingStream against a fake server stream.
func newTestClient(stream auctioneerrpc.ChannelAuctioneer_SubscribeBatchAuctionClient,
) (*Client, chan error) {
mainErrChan := make(chan error, 1)
c := &Client{
serverStream: stream,
FromServerChan: make(chan *auctioneerrpc.ServerAuctionMessage),
StreamErrChan: mainErrChan,
errChanSwitch: NewErrChanSwitch(mainErrChan),
quit: make(chan struct{}),
subscribedAccts: make(map[[33]byte]*acctSubscription),
}
c.errChanSwitch.Start()
return c, mainErrChan
}
// runReadLoop runs readIncomingStream in a goroutine and returns a channel
// that closes when the loop exits.
func runReadLoop(c *Client) <-chan struct{} {
done := make(chan struct{})
go func() {
c.readIncomingStream()
close(done)
}()
return done
}
// TestReadIncomingStreamEOFTriggersReconnect ensures that an io.EOF received
// on the server stream is surfaced as ErrServerErrored on the error channel,
// which is the signal the rpcserver consumer uses to trigger reconnect logic.
//
// This is a regression test: EOF was previously reported as a separate
// "ErrServerShutdown" sentinel that the consumer silently ignored under the
// (incorrect) assumption that the client had already scheduled its own
// reconnect. The result was a permanently dead subscription stream after any
// clean close (proxy/LB timeout, planned server shutdown, etc.), with the
// trader being filtered as offline until the process restarted.
func TestReadIncomingStreamEOFTriggersReconnect(t *testing.T) {
t.Parallel()
stream := &fakeServerStream{recv: make(chan recvResult, 1)}
c, mainErrChan := newTestClient(stream)
defer c.errChanSwitch.Stop()
defer close(c.quit)
// Tell the fake stream to return io.EOF, simulating the server (or an
// intermediate proxy) cleanly closing its side of the bidi stream.
stream.recv <- recvResult{err: io.EOF}
done := runReadLoop(c)
select {
case err := <-mainErrChan:
if !errors.Is(err, ErrServerErrored) {
t.Fatalf("expected ErrServerErrored on EOF, got: %v",
err)
}
case <-time.After(defaultTimeout):
t.Fatal("timed out waiting for error after EOF")
}
select {
case <-done:
case <-time.After(defaultTimeout):
t.Fatal("readIncomingStream did not return after EOF")
}
}
// TestReadIncomingStreamTransportErrorTriggersReconnect ensures non-EOF
// transport errors continue to be surfaced as ErrServerErrored. This is the
// pre-existing behaviour we want to preserve after unifying it with the EOF
// path.
func TestReadIncomingStreamTransportErrorTriggersReconnect(t *testing.T) {
t.Parallel()
stream := &fakeServerStream{recv: make(chan recvResult, 1)}
c, mainErrChan := newTestClient(stream)
defer c.errChanSwitch.Stop()
defer close(c.quit)
// A "transport is closing" style error, which is what gRPC surfaces
// when the underlying TCP connection breaks abruptly.
stream.recv <- recvResult{
err: status.Error(codes.Unavailable, "transport is closing"),
}
done := runReadLoop(c)
select {
case err := <-mainErrChan:
if !errors.Is(err, ErrServerErrored) {
t.Fatalf("expected ErrServerErrored on transport "+
"error, got: %v", err)
}
case <-time.After(defaultTimeout):
t.Fatal("timed out waiting for error after transport failure")
}
select {
case <-done:
case <-time.After(defaultTimeout):
t.Fatal("readIncomingStream did not return after transport " +
"failure")
}
}
// TestReadIncomingStreamContextCanceledDoesNotReconnect ensures that a
// codes.Canceled error (which happens when *we* cancel the stream context
// during shutdown or a planned reconnect) does NOT surface an error to the
// consumer, so we don't accidentally schedule a second reconnect.
func TestReadIncomingStreamContextCanceledDoesNotReconnect(t *testing.T) {
t.Parallel()
stream := &fakeServerStream{recv: make(chan recvResult, 1)}
c, mainErrChan := newTestClient(stream)
defer c.errChanSwitch.Stop()
defer close(c.quit)
stream.recv <- recvResult{
err: status.Error(codes.Canceled, "context canceled"),
}
done := runReadLoop(c)
select {
case <-done:
case <-time.After(defaultTimeout):
t.Fatal("readIncomingStream did not return after cancel")
}
select {
case err := <-mainErrChan:
t.Fatalf("unexpected error surfaced on cancel: %v", err)
case <-time.After(defaultTimeout):
// Expected: no error surfaced.
}
}
// TestConnectAndAuthenticateCleansUpOnError drives a full
// connectAndAuthenticate call in recovery mode against a scripted fake stream
// for each per-account error path that the auctioneer can return after the
// Subscribe message, and asserts the subscription entry is always removed
// from c.subscribedAccts on return.
//
// Regression: previously the entry was added to the map before authenticate
// ran (so readIncomingStream could route the server's Challenge/Error back
// to it) and was never removed on error paths. A later StartAccountSubscription
// for the same account — typically when handleStateOpen runs after on-chain
// confirmation — would hit the "already subscribed" early-return guard at the
// top of connectAndAuthenticate and silently no-op without sending a fresh
// Commit. The per-account 3-way handshake never ran and the trader stayed
// filtered as offline at matching time until the process restarted.
func TestConnectAndAuthenticateCleansUpOnError(t *testing.T) {
t.Parallel()
var pubKey [33]byte
copy(pubKey[:], testAccountDesc.PubKey.SerializeCompressed())
cases := []struct {
name string
errResp *auctioneerrpc.SubscribeError
checkRes func(t *testing.T, sub *acctSubscription,
canRecover bool, err error)
}{
{
// Realistic case: RecoverAccounts probes a key the
// auctioneer hasn't yet seen on chain.
name: "account does not exist",
errResp: &auctioneerrpc.SubscribeError{
ErrorCode: auctioneerrpc.SubscribeError_ACCOUNT_DOES_NOT_EXIST,
TraderKey: pubKey[:],
},
checkRes: func(t *testing.T, sub *acctSubscription,
canRecover bool, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if canRecover {
t.Fatal("expected canRecover=false")
}
if sub == nil {
t.Fatal("expected non-nil subscription")
}
},
},
{
// The auctioneer knows about a reservation for this
// key but the funding tx hasn't confirmed yet. The
// function returns a non-nil sub *and* a typed error,
// which makes the cleanup invariant especially easy
// to get wrong.
name: "incomplete account reservation",
errResp: &auctioneerrpc.SubscribeError{
ErrorCode: auctioneerrpc.SubscribeError_INCOMPLETE_ACCOUNT_RESERVATION,
TraderKey: pubKey[:],
AccountReservation: &auctioneerrpc.AuctionAccount{
Value: 100_000,
Expiry: 144,
TraderKey: pubKey[:],
AuctioneerKey: bytes.Repeat([]byte{0x02}, 33),
BatchKey: bytes.Repeat([]byte{0x03}, 33),
HeightHint: 1,
},
},
checkRes: func(t *testing.T, sub *acctSubscription,
canRecover bool, err error) {
var resErr *AcctResNotCompletedError
if !errors.As(err, &resErr) {
t.Fatalf("expected "+
"AcctResNotCompletedError, "+
"got %v", err)
}
if !canRecover {
t.Fatal("expected canRecover=true")
}
if sub == nil {
t.Fatal("expected non-nil subscription")
}
},
},
}
for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
runCleanupCase(t, pubKey, tc.errResp, tc.checkRes)
})
}
}
// runCleanupCase wires up a fresh Client + fake stream, drives a full
// connectAndAuthenticate handshake in recovery mode, feeds the supplied
// error response back at the Subscribe step, runs the caller's assertions on
// the return values, and finally asserts that subscribedAccts is empty.
func runCleanupCase(t *testing.T, pubKey [33]byte,
errResp *auctioneerrpc.SubscribeError,
checkRes func(t *testing.T, sub *acctSubscription, canRecover bool,
err error)) {
stream := &fakeServerStream{
recv: make(chan recvResult, 1),
sent: make(chan *auctioneerrpc.ClientAuctionMessage, 2),
}
mainErrChan := make(chan error, 1)
c := &Client{
cfg: &Config{
Signer: testSigner,
BatchVersion: order.LatestBatchVersion,
},
serverStream: stream,
FromServerChan: make(chan *auctioneerrpc.ServerAuctionMessage),
StreamErrChan: mainErrChan,
errChanSwitch: NewErrChanSwitch(mainErrChan),
quit: make(chan struct{}),
subscribedAccts: make(map[[33]byte]*acctSubscription),
}
c.errChanSwitch.Start()
defer c.errChanSwitch.Stop()
defer close(c.quit)
// Run the read loop in the background so server responses are routed
// to the subscription's msgChan via subscribedAccts lookups.
readDone := make(chan struct{})
go func() {
c.readIncomingStream()
close(readDone)
}()
type result struct {
sub *acctSubscription
canRecover bool
err error
}
resCh := make(chan result, 1)
go func() {
sub, canRecover, err := c.connectAndAuthenticate(
context.Background(), testAccountDesc, true,
)
resCh <- result{sub, canRecover, err}
}()
// Step 1: capture the Commit and echo its commitHash back in the
// Challenge so readIncomingStream can route it to the right sub.
var commitHash []byte
select {
case msg := <-stream.sent:
commit, ok := msg.Msg.(*auctioneerrpc.ClientAuctionMessage_Commit)
if !ok {
t.Fatalf("expected Commit, got %T", msg.Msg)
}
commitHash = commit.Commit.CommitHash
case <-time.After(defaultTimeout):
t.Fatal("did not receive Commit from client")
}
// Step 2: feed back the Challenge.
stream.recv <- recvResult{
msg: &auctioneerrpc.ServerAuctionMessage{
Msg: &auctioneerrpc.ServerAuctionMessage_Challenge{
Challenge: &auctioneerrpc.ServerChallenge{
Challenge: []byte{1, 2, 3, 4},
CommitHash: commitHash,
},
},
},
}
// Step 3: drain the Subscribe message so authenticate() returns.
select {
case msg := <-stream.sent:
if _, ok := msg.Msg.(*auctioneerrpc.ClientAuctionMessage_Subscribe); !ok {
t.Fatalf("expected Subscribe, got %T", msg.Msg)
}
case <-time.After(defaultTimeout):
t.Fatal("did not receive Subscribe from client")
}
// Step 4: server responds with the supplied error.
stream.recv <- recvResult{
msg: &auctioneerrpc.ServerAuctionMessage{
Msg: &auctioneerrpc.ServerAuctionMessage_Error{
Error: errResp,
},
},
}
// Step 5: connectAndAuthenticate should return; let the caller assert
// the return values.
var res result
select {
case res = <-resCh:
case <-time.After(defaultTimeout):
t.Fatal("connectAndAuthenticate did not return")
}
checkRes(t, res.sub, res.canRecover, res.err)
// In every error case, the subscription must NOT be left in the map.
// A later StartAccountSubscription for this account would otherwise
// hit the "already subscribed" guard and silently no-op without ever
// sending a fresh Commit.
c.subscribedAcctsMtx.Lock()
_, present := c.subscribedAccts[pubKey]
c.subscribedAcctsMtx.Unlock()
if present {
t.Fatal("subscribedAccts entry was not cleaned up; later " +
"subscribes for the same account would silently no-op")
}
// Clean up the background read loop. Sending io.EOF unblocks the
// Recv call and lets readIncomingStream exit cleanly.
stream.recv <- recvResult{err: io.EOF}
select {
case <-readDone:
case <-time.After(defaultTimeout):
t.Fatal("read loop did not exit after EOF")
}
}
// TestHandleServerShutdownPartialResubscribeFailure asserts that
// HandleServerShutdown attempts to re-subscribe every account even when one
// of the handshakes fails server-side. The current loop bails on the first
// error, silently leaving the remaining accounts un-subscribed.
func TestHandleServerShutdownPartialResubscribeFailure(t *testing.T) {
t.Parallel()
// Three distinct account keys.
keys := make([]*keychain.KeyDescriptor, 3)
for i := range keys {
priv, err := btcec.NewPrivateKey()
if err != nil {
t.Fatalf("could not generate key: %v", err)
}
keys[i] = &keychain.KeyDescriptor{PubKey: priv.PubKey()}
}
keyBytes := func(k *keychain.KeyDescriptor) [33]byte {
var b [33]byte
copy(b[:], k.PubKey.SerializeCompressed())
return b
}
// Stream that connectServerStream will hand back after closeStream.
stream := &fakeServerStream{
recv: make(chan recvResult, 8),
sent: make(chan *auctioneerrpc.ClientAuctionMessage, 8),
}
mainErrChan := make(chan error, 4)
c := &Client{
cfg: &Config{
Signer: testSigner,
BatchVersion: order.LatestBatchVersion,
MinBackoff: time.Millisecond,
MaxBackoff: time.Millisecond,
BatchSource: noPendingBatchSource{},
},
client: &fakeAuctioneerClient{stream: stream},
FromServerChan: make(chan *auctioneerrpc.ServerAuctionMessage),
StreamErrChan: mainErrChan,
errChanSwitch: NewErrChanSwitch(mainErrChan),
quit: make(chan struct{}),
subscribedAccts: make(map[[33]byte]*acctSubscription),
}
c.errChanSwitch.Start()
defer c.errChanSwitch.Stop()
defer close(c.quit)
// Pre-populate the subscribed accounts. HandleServerShutdown only reads
// acctKey out of each subscription to seed its re-subscribe loop; the
// channels here are placeholders.
for _, k := range keys {
c.subscribedAccts[keyBytes(k)] = &acctSubscription{
acctKey: k,
msgChan: make(chan *auctioneerrpc.ServerAuctionMessage),
quit: make(chan struct{}),
}
}
// Orchestrator: walk each handshake through Challenge + final
// response. The first attempt always gets ACCOUNT_DOES_NOT_EXIST;
// the rest get Success. Failing on the first attempt (rather than a
// fixed key) keeps the assertion deterministic under Go's randomized
// map iteration order.
var (
attemptedMtx sync.Mutex
attempted = make(map[[33]byte]struct{})
)
go func() {
first := true
for {
var msg *auctioneerrpc.ClientAuctionMessage
select {
case msg = <-stream.sent:
case <-c.quit:
return
}
commit, ok := msg.Msg.(*auctioneerrpc.ClientAuctionMessage_Commit)
if !ok {
continue
}
// Send Challenge back with the matching commitHash so
// readIncomingStream can route it.
stream.recv <- recvResult{
msg: &auctioneerrpc.ServerAuctionMessage{
Msg: &auctioneerrpc.ServerAuctionMessage_Challenge{
Challenge: &auctioneerrpc.ServerChallenge{
Challenge: []byte{1, 2, 3, 4},
CommitHash: commit.Commit.CommitHash,
},
},
},
}
// Wait for the Subscribe with the trader key.
var subMsg *auctioneerrpc.ClientAuctionMessage
select {
case subMsg = <-stream.sent:
case <-c.quit:
return
}
sub, ok := subMsg.Msg.(*auctioneerrpc.ClientAuctionMessage_Subscribe)
if !ok {
continue
}
var traderKey [33]byte
copy(traderKey[:], sub.Subscribe.TraderKey)
attemptedMtx.Lock()
attempted[traderKey] = struct{}{}
attemptedMtx.Unlock()
final := &auctioneerrpc.ServerAuctionMessage{
Msg: &auctioneerrpc.ServerAuctionMessage_Success{
Success: &auctioneerrpc.SubscribeSuccess{
TraderKey: sub.Subscribe.TraderKey,
},
},
}
if first {
final = &auctioneerrpc.ServerAuctionMessage{
Msg: &auctioneerrpc.ServerAuctionMessage_Error{
Error: &auctioneerrpc.SubscribeError{
ErrorCode: auctioneerrpc.SubscribeError_ACCOUNT_DOES_NOT_EXIST,
TraderKey: sub.Subscribe.TraderKey,
},
},
}
first = false
}
stream.recv <- recvResult{msg: final}
}
}()
// Drive HandleServerShutdown in a goroutine.
shutdownErr := make(chan error, 1)
go func() {
shutdownErr <- c.HandleServerShutdown(nil)
}()
// Wait for HandleServerShutdown to return. With the bug, it returns
// after the first handshake's error. With a fix, it returns after
// all three handshakes complete.
select {
case <-shutdownErr:
case <-time.After(2 * time.Second):
t.Fatal("HandleServerShutdown did not return")
}
// Every account must have been attempted, even though one handshake
// failed. Otherwise that single failure silently took the rest of the
// trader's accounts offline.
attemptedMtx.Lock()
got := len(attempted)
attemptedMtx.Unlock()
if got < len(keys) {
t.Fatalf("expected re-subscribe to attempt all %d accounts, "+
"only attempted %d — the loop bails on first error "+
"and leaves later accounts silently un-subscribed",
len(keys), got)
}
// Terminate the readIncomingStream goroutine that connectServerStream
// spawned, so it doesn't leak past the test.
stream.recv <- recvResult{err: io.EOF}
}

View file

@ -1,7 +1,7 @@
package auctioneer
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v3.21.12
// protoc-gen-go v1.31.0
// protoc v3.6.1
// source: auctioneer.proto
// We can't rename this to auctioneerrpc, otherwise it would be a breaking
@ -6664,7 +6664,7 @@ func file_auctioneer_proto_rawDescGZIP() []byte {
var file_auctioneer_proto_enumTypes = make([]protoimpl.EnumInfo, 14)
var file_auctioneer_proto_msgTypes = make([]protoimpl.MessageInfo, 79)
var file_auctioneer_proto_goTypes = []any{
var file_auctioneer_proto_goTypes = []interface{}{
(ChannelType)(0), // 0: poolrpc.ChannelType
(AuctionAccountState)(0), // 1: poolrpc.AuctionAccountState
(OrderChannelType)(0), // 2: poolrpc.OrderChannelType
@ -6889,7 +6889,7 @@ func file_auctioneer_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_auctioneer_proto_msgTypes[0].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReserveAccountRequest); i {
case 0:
return &v.state
@ -6901,7 +6901,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[1].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReserveAccountResponse); i {
case 0:
return &v.state
@ -6913,7 +6913,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[2].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerInitAccountRequest); i {
case 0:
return &v.state
@ -6925,7 +6925,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[3].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerInitAccountResponse); i {
case 0:
return &v.state
@ -6937,7 +6937,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[4].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerSubmitOrderRequest); i {
case 0:
return &v.state
@ -6949,7 +6949,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[5].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerSubmitOrderResponse); i {
case 0:
return &v.state
@ -6961,7 +6961,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[6].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerCancelOrderRequest); i {
case 0:
return &v.state
@ -6973,7 +6973,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[7].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerCancelOrderResponse); i {
case 0:
return &v.state
@ -6985,7 +6985,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[8].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientAuctionMessage); i {
case 0:
return &v.state
@ -6997,7 +6997,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[9].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountCommitment); i {
case 0:
return &v.state
@ -7009,7 +7009,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[10].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountSubscription); i {
case 0:
return &v.state
@ -7021,7 +7021,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[11].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderMatchAccept); i {
case 0:
return &v.state
@ -7033,7 +7033,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[12].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderMatchReject); i {
case 0:
return &v.state
@ -7045,7 +7045,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[13].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderReject); i {
case 0:
return &v.state
@ -7057,7 +7057,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[14].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ChannelInfo); i {
case 0:
return &v.state
@ -7069,7 +7069,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[15].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderMatchSign); i {
case 0:
return &v.state
@ -7081,7 +7081,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[16].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountRecovery); i {
case 0:
return &v.state
@ -7093,7 +7093,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[17].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerAuctionMessage); i {
case 0:
return &v.state
@ -7105,7 +7105,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[18].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerChallenge); i {
case 0:
return &v.state
@ -7117,7 +7117,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[19].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubscribeSuccess); i {
case 0:
return &v.state
@ -7129,7 +7129,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[20].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedMarket); i {
case 0:
return &v.state
@ -7141,7 +7141,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[21].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderMatchPrepare); i {
case 0:
return &v.state
@ -7153,7 +7153,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[22].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TxOut); i {
case 0:
return &v.state
@ -7165,7 +7165,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[23].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderMatchSignBegin); i {
case 0:
return &v.state
@ -7177,7 +7177,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[24].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderMatchFinalize); i {
case 0:
return &v.state
@ -7189,7 +7189,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[25].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubscribeError); i {
case 0:
return &v.state
@ -7201,7 +7201,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[26].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuctionAccount); i {
case 0:
return &v.state
@ -7213,7 +7213,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[27].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedOrder); i {
case 0:
return &v.state
@ -7225,7 +7225,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[28].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedAsk); i {
case 0:
return &v.state
@ -7237,7 +7237,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[29].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedBid); i {
case 0:
return &v.state
@ -7249,7 +7249,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[30].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountDiff); i {
case 0:
return &v.state
@ -7261,7 +7261,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[31].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerOrder); i {
case 0:
return &v.state
@ -7273,7 +7273,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[32].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerBid); i {
case 0:
return &v.state
@ -7285,7 +7285,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[33].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerAsk); i {
case 0:
return &v.state
@ -7297,7 +7297,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[34].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CancelOrder); i {
case 0:
return &v.state
@ -7309,7 +7309,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[35].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InvalidOrder); i {
case 0:
return &v.state
@ -7321,7 +7321,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[36].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerInput); i {
case 0:
return &v.state
@ -7333,7 +7333,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[37].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerOutput); i {
case 0:
return &v.state
@ -7345,7 +7345,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[38].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerModifyAccountRequest); i {
case 0:
return &v.state
@ -7357,7 +7357,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[39].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerModifyAccountResponse); i {
case 0:
return &v.state
@ -7369,7 +7369,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[40].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerOrderStateRequest); i {
case 0:
return &v.state
@ -7381,7 +7381,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[41].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerOrderStateResponse); i {
case 0:
return &v.state
@ -7393,7 +7393,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[42].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TermsRequest); i {
case 0:
return &v.state
@ -7405,7 +7405,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[43].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TermsResponse); i {
case 0:
return &v.state
@ -7417,7 +7417,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[44].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RelevantBatchRequest); i {
case 0:
return &v.state
@ -7429,7 +7429,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[45].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RelevantBatch); i {
case 0:
return &v.state
@ -7441,7 +7441,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[46].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ExecutionFee); i {
case 0:
return &v.state
@ -7453,7 +7453,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[47].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeAddress); i {
case 0:
return &v.state
@ -7465,7 +7465,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[48].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OutPoint); i {
case 0:
return &v.state
@ -7477,7 +7477,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[49].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AskSnapshot); i {
case 0:
return &v.state
@ -7489,7 +7489,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[50].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BidSnapshot); i {
case 0:
return &v.state
@ -7501,7 +7501,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[51].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedOrderSnapshot); i {
case 0:
return &v.state
@ -7513,7 +7513,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[52].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BatchSnapshotRequest); i {
case 0:
return &v.state
@ -7525,7 +7525,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[53].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchedMarketSnapshot); i {
case 0:
return &v.state
@ -7537,7 +7537,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[54].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BatchSnapshotResponse); i {
case 0:
return &v.state
@ -7549,7 +7549,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[55].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerNodeRatingRequest); i {
case 0:
return &v.state
@ -7561,7 +7561,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[56].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeRating); i {
case 0:
return &v.state
@ -7573,7 +7573,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[57].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerNodeRatingResponse); i {
case 0:
return &v.state
@ -7585,7 +7585,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[58].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BatchSnapshotsRequest); i {
case 0:
return &v.state
@ -7597,7 +7597,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[59].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BatchSnapshotsResponse); i {
case 0:
return &v.state
@ -7609,7 +7609,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[60].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MarketInfoRequest); i {
case 0:
return &v.state
@ -7621,7 +7621,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[61].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MarketInfo); i {
case 0:
return &v.state
@ -7633,7 +7633,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[62].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MarketInfoResponse); i {
case 0:
return &v.state
@ -7645,7 +7645,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[71].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerModifyAccountRequest_NewAccountParameters); i {
case 0:
return &v.state
@ -7657,7 +7657,7 @@ func file_auctioneer_proto_init() {
return nil
}
}
file_auctioneer_proto_msgTypes[77].Exporter = func(v any, i int) any {
file_auctioneer_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MarketInfo_TierValue); i {
case 0:
return &v.state
@ -7670,15 +7670,15 @@ func file_auctioneer_proto_init() {
}
}
}
file_auctioneer_proto_msgTypes[4].OneofWrappers = []any{
file_auctioneer_proto_msgTypes[4].OneofWrappers = []interface{}{
(*ServerSubmitOrderRequest_Ask)(nil),
(*ServerSubmitOrderRequest_Bid)(nil),
}
file_auctioneer_proto_msgTypes[5].OneofWrappers = []any{
file_auctioneer_proto_msgTypes[5].OneofWrappers = []interface{}{
(*ServerSubmitOrderResponse_InvalidOrder)(nil),
(*ServerSubmitOrderResponse_Accepted)(nil),
}
file_auctioneer_proto_msgTypes[8].OneofWrappers = []any{
file_auctioneer_proto_msgTypes[8].OneofWrappers = []interface{}{
(*ClientAuctionMessage_Commit)(nil),
(*ClientAuctionMessage_Subscribe)(nil),
(*ClientAuctionMessage_Accept)(nil),
@ -7686,7 +7686,7 @@ func file_auctioneer_proto_init() {
(*ClientAuctionMessage_Sign)(nil),
(*ClientAuctionMessage_Recover)(nil),
}
file_auctioneer_proto_msgTypes[17].OneofWrappers = []any{
file_auctioneer_proto_msgTypes[17].OneofWrappers = []interface{}{
(*ServerAuctionMessage_Challenge)(nil),
(*ServerAuctionMessage_Success)(nil),
(*ServerAuctionMessage_Error)(nil),

View file

@ -1,16 +1,8 @@
module github.com/lightninglabs/pool/auctioneerrpc
require (
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.34.2
)
go 1.15
require (
github.com/golang/protobuf v1.5.3 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.33.0
)
go 1.23.6

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v3.21.12
// protoc-gen-go v1.31.0
// protoc v3.6.1
// source: hashmail.proto
// We can't rename this to auctioneerrpc, otherwise it would be a breaking
@ -670,7 +670,7 @@ func file_hashmail_proto_rawDescGZIP() []byte {
}
var file_hashmail_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_hashmail_proto_goTypes = []any{
var file_hashmail_proto_goTypes = []interface{}{
(*PoolAccountAuth)(nil), // 0: poolrpc.PoolAccountAuth
(*SidecarAuth)(nil), // 1: poolrpc.SidecarAuth
(*CipherBoxAuth)(nil), // 2: poolrpc.CipherBoxAuth
@ -712,7 +712,7 @@ func file_hashmail_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_hashmail_proto_msgTypes[0].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PoolAccountAuth); i {
case 0:
return &v.state
@ -724,7 +724,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[1].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SidecarAuth); i {
case 0:
return &v.state
@ -736,7 +736,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[2].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherBoxAuth); i {
case 0:
return &v.state
@ -748,7 +748,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[3].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DelCipherBoxResp); i {
case 0:
return &v.state
@ -760,7 +760,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[4].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherChallenge); i {
case 0:
return &v.state
@ -772,7 +772,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[5].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherError); i {
case 0:
return &v.state
@ -784,7 +784,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[6].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherSuccess); i {
case 0:
return &v.state
@ -796,7 +796,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[7].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherInitResp); i {
case 0:
return &v.state
@ -808,7 +808,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[8].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherBoxDesc); i {
case 0:
return &v.state
@ -820,7 +820,7 @@ func file_hashmail_proto_init() {
return nil
}
}
file_hashmail_proto_msgTypes[9].Exporter = func(v any, i int) any {
file_hashmail_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CipherBox); i {
case 0:
return &v.state
@ -833,11 +833,11 @@ func file_hashmail_proto_init() {
}
}
}
file_hashmail_proto_msgTypes[2].OneofWrappers = []any{
file_hashmail_proto_msgTypes[2].OneofWrappers = []interface{}{
(*CipherBoxAuth_AcctAuth)(nil),
(*CipherBoxAuth_SidecarAuth)(nil),
}
file_hashmail_proto_msgTypes[7].OneofWrappers = []any{
file_hashmail_proto_msgTypes[7].OneofWrappers = []interface{}{
(*CipherInitResp_Success)(nil),
(*CipherInitResp_Challenge)(nil),
(*CipherInitResp_Error)(nil),

View file

@ -1,7 +1,7 @@
package clientdb
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -499,6 +499,7 @@ func parseAccountKey(ctx *cli.Context, args cli.Args) ([]byte, error) {
acctKeyStr = ctx.String("acct_key")
case args.Present():
acctKeyStr = args.First()
args = args.Tail()
default:
return nil, fmt.Errorf("acct_key argument missing")
}
@ -1003,6 +1004,7 @@ func ordersCancel(ctx *cli.Context) error { // nolint: dupl
nonceHex = ctx.String("order_nonce")
case args.Present():
nonceHex = args.First()
args = args.Tail()
default:
return fmt.Errorf("order_nonce argument missing")
}

View file

@ -12,7 +12,6 @@ import (
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/cert"
"github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/lnrpc"
@ -39,6 +38,9 @@ var (
defaultLogDirname = "logs"
defaultLogDir = filepath.Join(DefaultBaseDir, defaultLogDirname)
defaultMaxLogFiles = 3
defaultMaxLogFileSize = 10
defaultMinBackoff = 5 * time.Second
defaultMaxBackoff = 1 * time.Minute
@ -124,8 +126,8 @@ type Config struct {
BaseDir string `long:"basedir" description:"The base directory where pool stores all its data. If set, this option overwrites --logdir, --macaroonpath, --tlscertpath and --tlskeypath."`
LogDir string `long:"logdir" description:"Directory to log output."`
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation). DEPRECATED: Use --logging.file.max-files instead" hidden:"true"`
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB. DEPRECATED: Use --logging.file.max-file-size instead" hidden:"true"`
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation)"`
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB"`
MinBackoff time.Duration `long:"minbackoff" description:"Shortest backoff when reconnecting to the server. Valid time units are {s, m, h}."`
MaxBackoff time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to the server. Valid time units are {s, m, h}."`
@ -151,9 +153,6 @@ type Config struct {
Lnd *LndConfig `group:"lnd" namespace:"lnd"`
// Logging controls various aspects of pool logging.
Logging *build.LogConfig `group:"logging" namespace:"logging"`
// RPCListener is a network listener that can be set if poold should be
// used as a library and listen on the given listener instead of what is
// configured in the --rpclisten parameter. Setting this will also
@ -204,7 +203,8 @@ func DefaultConfig() Config {
Insecure: false,
BaseDir: DefaultBaseDir,
LogDir: defaultLogDir,
Logging: build.DefaultLogConfig(),
MaxLogFiles: defaultMaxLogFiles,
MaxLogFileSize: defaultMaxLogFileSize,
MinBackoff: defaultMinBackoff,
MaxBackoff: defaultMaxBackoff,
DebugLevel: defaultLogLevel,

View file

@ -22,7 +22,7 @@ Note that the trader can reject signing the batch for any reason, even when the
### Batch Publication
When all participating traders have signed their inputs in the Batch Execution Transaction, the auctioneer can sign the final input and broadcast the transaction. This transaction can be large, and serve as the funding transaction for potentially hundreds of channels! The participating traders only pay chain fees for their inputs and outputs in the transaction, so everybody is saving substantially on fees compared to individually funding channels. If the trader supports account autorenewal and the account was close to expire, its expiry height will be automatically extended after the batch is successfully executed.
When all participating traders have signed their inputs in the Batch Execution Transaction, the auctioneer can sign the final input and broadcast the transaction. This transaction can be large, and serve as the funding transaction for potentially hundres of channels! The participating traders only pay chain fees for their inputs and outputs in the transaction, so everybody is saving substantially on fees compared to individually funding channels. If the trader supports account autorenewal and the account was close to expire, its expiry height will be automatically extended after the batch is sucessfully executed.
## Batched Uniform-Price Clearing

View file

@ -16,8 +16,7 @@ To run `poold` integrated into the Lightning Terminal, download [the latest rele
### Building the binaries from source
To build both the `poold` and `pool` binaries from the source code, at least
the `go 1.18` and `make` must be installed.
To build both the `poold` and `pool` binaries from the source code, at least the `go 1.14` and `make` must be installed.
To download the code, compile and install it, the following commands can then be run:

View file

@ -69,7 +69,7 @@ needs to work, therefore we show the more involved example here.
The addition of this "auto" mode means that both sides need to only execute
a single and the rest of the negotiation happens in the background. If the
`auto` flag is omitted, then only the capacity and balance need to be
`auto` flag is ommitted, then only the capacity and balance need to be
specified, otherwise, all the other information one presents when submitting
a full order needs to be specified.

View file

@ -1,7 +1,7 @@
package funding
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -40,12 +40,6 @@ var (
rpcCodeFundingFailed = auctioneerrpc.OrderReject_CHANNEL_FUNDING_FAILED
)
const (
// maxStreamRecreateAttempts is the maximum number of attempts to
// recreate a channel event stream before giving up.
maxStreamRecreateAttempts = 3
)
// MatchRejectErr is an error type that is returned from the funding manager if
// the trader rejects certain orders instead of the whole batch.
type MatchRejectErr struct {
@ -182,12 +176,10 @@ func (m *Manager) Start() error {
streamCtx, &lnrpc.ChannelEventSubscription{},
)
if err != nil {
streamCancel()
return err
}
if err := m.pendingOpenChanServer.Start(); err != nil {
streamCancel()
return fmt.Errorf("error starting pending chan subscription "+
"server: %v", err)
}
@ -197,7 +189,6 @@ func (m *Manager) Start() error {
// updates, that's why we are a client to our own server.
m.pendingOpenChanClient, err = m.SubscribePendingOpenChan()
if err != nil {
streamCancel()
return fmt.Errorf("error subscribing to pending open "+
"channel events: %v", err)
}
@ -236,36 +227,6 @@ func (m *Manager) Stop() error {
return nil
}
// streamBackoff manages exponential backoff for stream errors.
type streamBackoff struct {
attempts int
maxDelay time.Duration
}
// newStreamBackoff creates a new stream backoff manager.
func newStreamBackoff(maxDelay time.Duration) *streamBackoff {
return &streamBackoff{
maxDelay: maxDelay,
}
}
// nextDelay returns the next backoff delay based on the number of attempts.
func (s *streamBackoff) nextDelay() time.Duration {
s.attempts++
delay := time.Duration(s.attempts) * time.Second
if delay > s.maxDelay {
delay = s.maxDelay
}
return delay
}
// reset resets the backoff counter.
func (s *streamBackoff) reset() {
s.attempts = 0
}
// consumePendingOpenChannels consumes pending open channel events from the
// stream and notifies them if the trader currently has an ongoing batch.
func (m *Manager) consumePendingOpenChannels(
@ -273,68 +234,33 @@ func (m *Manager) consumePendingOpenChannels(
defer m.wg.Done()
currentStream := subStream
streamCtx, streamCancel := context.WithCancel(context.Background())
defer streamCancel()
// Initialize backoff manager with 30 second max delay.
backoff := newStreamBackoff(30 * time.Second)
for {
select {
case <-m.quit:
return
case <-currentStream.Context().Done():
// The stream context was canceled, we need to establish
// a new stream.
log.Warnf("Channel event stream context " +
"canceled, creating new stream")
newStream := m.recreateChannelEventStream(streamCtx)
if newStream == nil {
return
}
currentStream = newStream
backoff.reset()
continue
default:
}
msg, err := currentStream.Recv()
msg, err := subStream.Recv()
if err != nil {
if m.shouldExitOnError(err) {
select {
case <-m.quit:
return
default:
}
if m.shouldRecreateStream(err) {
newStream := m.recreateChannelEventStream(
streamCtx,
)
log.Errorf("Unable to read channel event: %v", err)
if newStream == nil {
return
}
// If the lnd node shut down, there's no use continuing.
if err == io.EOF || err == io.ErrUnexpectedEOF ||
status.Code(err) == codes.Unavailable {
currentStream = newStream
backoff.reset()
continue
}
// For other errors, wait with a backoff and retry with
// the same stream.
if !m.waitOrQuit(backoff.nextDelay()) {
return
}
continue
}
// Reset backoff on successful receive.
backoff.reset()
// Skip any events other than the pending open channel one.
channel, ok := msg.Channel.(*lnrpc.ChannelEventUpdate_PendingOpenChannel)
if !ok {
@ -348,95 +274,6 @@ func (m *Manager) consumePendingOpenChannels(
}
}
// recreateChannelEventStream attempts to create a new channel event stream. It
// returns nil if the manager is shutting down or if stream creation fails after
// retries.
func (m *Manager) recreateChannelEventStream(ctx context.Context,
) lnrpc.Lightning_SubscribeChannelEventsClient {
for retries := 0; retries < maxStreamRecreateAttempts; retries++ {
newStream, err := m.cfg.BaseClient.SubscribeChannelEvents(
ctx, &lnrpc.ChannelEventSubscription{},
)
if err == nil {
return newStream
}
log.Errorf("Unable to establish channel event "+
"stream (attempt %d/%d): %v",
retries+1, maxStreamRecreateAttempts, err)
// Check if we're shutting down before retrying.
backoff := time.Duration(retries+1) * time.Second
if !m.waitOrQuit(backoff) {
return nil
}
}
log.Errorf("Failed to re-establish channel event stream "+
"after %d attempts", maxStreamRecreateAttempts)
return nil
}
// shouldExitOnError determines if the given error should cause the consumer to
// exit completely.
func (m *Manager) shouldExitOnError(err error) bool {
log.Errorf("Unable to read channel event: %v", err)
// Check if we're shutting down first.
select {
case <-m.quit:
return true
default:
}
// If the lnd node is unavailable, we should exit.
if status.Code(err) == codes.Unavailable {
log.Errorf("lnd node unavailable, stopping " +
"channel event consumption")
return true
}
return false
}
// shouldRecreateStream determines if the given error indicates that a new
// stream should be created.
func (m *Manager) shouldRecreateStream(err error) bool {
switch {
case err == io.EOF || err == io.ErrUnexpectedEOF:
log.Infof("Channel event stream ended (EOF), " +
"creating new stream")
return true
case status.Code(err) == codes.Canceled:
log.Infof("Channel event stream canceled, " +
"creating new stream")
return true
case status.Code(err) == codes.DeadlineExceeded:
log.Infof("Channel event stream deadline " +
"exceeded, creating new stream")
return true
default:
return false
}
}
// waitOrQuit waits for the specified duration or until the manager is
// shutting down. Returns false if the manager is shutting down.
func (m *Manager) waitOrQuit(duration time.Duration) bool {
select {
case <-time.After(duration):
return true
case <-m.quit:
return false
}
}
// SubscribePendingOpenChan creates a new subscription client to receive events
// for pending open channels from lnd.
func (m *Manager) SubscribePendingOpenChan() (*subscribe.Client, error) {

View file

@ -99,10 +99,6 @@ type channelEventStream struct {
quit chan struct{}
}
func (c *channelEventStream) Context() context.Context {
return c.ctx
}
func (c *channelEventStream) Recv() (*lnrpc.ChannelEventUpdate, error) {
select {
case msg := <-c.updateChan:

View file

@ -1,6 +1,6 @@
FROM golang:1.23.6-bookworm
FROM golang:1.19.4-bullseye
RUN go install go.uber.org/mock/mockgen@v0.4.0
RUN go install github.com/golang/mock/mockgen@73266f9366fcf2ccef0b880618e5a9266e4136f4
WORKDIR /build

216
go.mod
View file

@ -1,210 +1,184 @@
module github.com/lightninglabs/pool
require (
github.com/btcsuite/btcd v0.24.3-0.20250318170759-4f4ea81776d6
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd v0.24.0
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/btcsuite/btcd/btcutil v1.1.5
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/btcsuite/btclog/v2 v2.0.1-0.20250110154127-3ae4bf1cb318
github.com/btcsuite/btcwallet v0.16.13
github.com/btcsuite/btcwallet/wallet/txrules v1.2.2
github.com/btcsuite/btcwallet/wtxmgr v1.5.6
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcwallet v0.16.10-0.20230804184612-07be54bc22cf
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
github.com/btcsuite/btcwallet/wtxmgr v1.5.0
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
github.com/golang/mock v1.6.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3
github.com/jessevdk/go-flags v1.4.0
github.com/lightninglabs/aperture v0.3.8-beta
github.com/lightninglabs/lndclient v0.19.0-7
github.com/lightninglabs/pool/auctioneerrpc v1.1.2
github.com/lightninglabs/pool/poolrpc v1.0.1
github.com/lightningnetwork/lnd v0.19.0-beta
github.com/lightninglabs/aperture v0.3.2-beta
github.com/lightninglabs/lndclient v0.17.0-1
github.com/lightninglabs/pool/auctioneerrpc v1.1.1
github.com/lightningnetwork/lnd v0.17.0-beta
github.com/lightningnetwork/lnd/cert v1.2.2
github.com/lightningnetwork/lnd/fn/v2 v2.0.8
github.com/lightningnetwork/lnd/kvdb v1.4.16
github.com/lightningnetwork/lnd/tlv v1.3.1
github.com/lightningnetwork/lnd/tor v1.1.6
github.com/stretchr/testify v1.10.0
github.com/urfave/cli v1.22.14
go.etcd.io/bbolt v1.3.11
go.uber.org/mock v0.4.0
golang.org/x/sync v0.12.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
github.com/lightningnetwork/lnd/kvdb v1.4.4
github.com/lightningnetwork/lnd/tlv v1.1.1
github.com/lightningnetwork/lnd/tor v1.1.2
github.com/stretchr/testify v1.8.4
github.com/urfave/cli v1.22.9
go.etcd.io/bbolt v1.3.7
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.33.0
gopkg.in/macaroon-bakery.v2 v2.1.0
gopkg.in/macaroon.v2 v2.1.0
)
require (
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344 // indirect
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
github.com/aead/siphash v1.0.1 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c // indirect
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 // indirect
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 // indirect
github.com/btcsuite/btcwallet/walletdb v1.5.1 // indirect
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 // indirect
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 // indirect
github.com/btcsuite/btcwallet/walletdb v1.4.0 // indirect
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
github.com/btcsuite/winsvc v1.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/lru v1.1.2 // indirect
github.com/docker/cli v28.0.1+incompatible // indirect
github.com/docker/docker v28.0.1+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fergusstrange/embedded-postgres v1.25.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/lru v1.0.0 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fergusstrange/embedded-postgres v1.10.0 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang-migrate/migrate/v4 v4.17.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.3 // indirect
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 // indirect
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/jackc/pgx/v4 v4.18.2 // indirect
github.com/jackc/pgx/v5 v5.5.4 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jackpal/gateway v1.0.5 // indirect
github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/jrick/logrotate v1.1.2 // indirect
github.com/jrick/logrotate v1.0.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kkdai/bstream v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect
github.com/lightninglabs/neutrino v0.16.1 // indirect
github.com/lightninglabs/neutrino/cache v1.1.2 // indirect
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect
github.com/lightninglabs/neutrino v0.16.0 // indirect
github.com/lightninglabs/neutrino/cache v1.1.1 // indirect
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f // indirect
github.com/lightningnetwork/lnd/clock v1.1.1 // indirect
github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect
github.com/lightningnetwork/lnd/healthcheck v1.2.3 // indirect
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
github.com/lightningnetwork/lnd/sqldb v1.0.9 // indirect
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mholt/archiver/v3 v3.5.0 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/sys/user v0.3.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.2.8 // indirect
github.com/ory/dockertest/v3 v3.10.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/nwaples/rardecode v1.1.2 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.1 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.2 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/tv42/zbase32 v0.0.0-20160707012821-501572607d02 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect
go.etcd.io/etcd/client/v2 v2.305.12 // indirect
go.etcd.io/etcd/client/v3 v3.5.12 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.12 // indirect
go.etcd.io/etcd/raft/v3 v3.5.12 // indirect
go.etcd.io/etcd/server/v3 v3.5.12 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/v2 v2.305.7 // indirect
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/raft/v3 v3.5.7 // indirect
go.etcd.io/etcd/server/v3 v3.5.7 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.1 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/term v0.30.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
gopkg.in/errgo.v1 v1.0.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.49.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.29.10 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
pgregory.net/rapid v1.2.0 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
modernc.org/libc v1.22.2 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.4.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.20.3 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
// We want to format raw bytes as hex instead of base64. The forked version
// allows us to specify that as an option.
replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display
replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display
replace github.com/lightninglabs/pool/auctioneerrpc => ./auctioneerrpc
replace github.com/lightninglabs/pool/poolrpc => ./poolrpc
go 1.23.6
go 1.19

1853
go.sum

File diff suppressed because it is too large Load diff

View file

@ -177,7 +177,13 @@ func (m *MockLightning) AddInvoice(_ context.Context,
SignCompact: func(hash []byte) ([]byte, error) {
// ecdsa.SignCompact returns a
// pubkey-recoverable signature.
sig := ecdsa.SignCompact(privKey, hash, true)
sig, err := ecdsa.SignCompact(
privKey, hash, true,
)
if err != nil {
return nil, fmt.Errorf("can't sign "+
"the hash: %v", err)
}
return sig, nil
},
@ -232,8 +238,8 @@ func (m *MockLightning) ListTransactions(_ context.Context, _, _ int32,
}
// ListChannels retrieves all channels of the backing lnd node.
func (m *MockLightning) ListChannels(context.Context, bool, bool,
...lndclient.ListChannelsOption) ([]lndclient.ChannelInfo, error) {
func (m *MockLightning) ListChannels(context.Context, bool,
bool) ([]lndclient.ChannelInfo, error) {
return m.Channels, nil
}
@ -370,8 +376,7 @@ func (m *MockLightning) OpenChannel(_ context.Context, peer route.Vertex,
}
func (m *MockLightning) CloseChannel(context.Context, *wire.OutPoint,
bool, int32, btcutil.Address,
...lndclient.CloseChannelOption) (chan lndclient.CloseChannelUpdate,
bool, int32, btcutil.Address) (chan lndclient.CloseChannelUpdate,
chan error, error) {
return nil, nil, nil

View file

@ -1,10 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: internal/test/interfaces.go
//
// Generated by this command:
//
// mockgen -source=internal/test/interfaces.go -package=test -destination=internal/test/mock_interfaces.go
//
// Package test is a generated GoMock package.
package test
@ -21,16 +16,14 @@ import (
wire "github.com/btcsuite/btcd/wire"
waddrmgr "github.com/btcsuite/btcwallet/waddrmgr"
wtxmgr "github.com/btcsuite/btcwallet/wtxmgr"
gomock "github.com/golang/mock/gomock"
lndclient "github.com/lightninglabs/lndclient"
chainntnfs "github.com/lightningnetwork/lnd/chainntnfs"
input "github.com/lightningnetwork/lnd/input"
keychain "github.com/lightningnetwork/lnd/keychain"
chainrpc "github.com/lightningnetwork/lnd/lnrpc/chainrpc"
signrpc "github.com/lightningnetwork/lnd/lnrpc/signrpc"
walletrpc "github.com/lightningnetwork/lnd/lnrpc/walletrpc"
lnwallet "github.com/lightningnetwork/lnd/lnwallet"
chainfee "github.com/lightningnetwork/lnd/lnwallet/chainfee"
gomock "go.uber.org/mock/gomock"
)
// MockSignerClient is a mock of SignerClient interface.
@ -66,7 +59,7 @@ func (m *MockSignerClient) ComputeInputScript(ctx context.Context, tx *wire.MsgT
}
// ComputeInputScript indicates an expected call of ComputeInputScript.
func (mr *MockSignerClientMockRecorder) ComputeInputScript(ctx, tx, signDescriptors, prevOutputs any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) ComputeInputScript(ctx, tx, signDescriptors, prevOutputs interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComputeInputScript", reflect.TypeOf((*MockSignerClient)(nil).ComputeInputScript), ctx, tx, signDescriptors, prevOutputs)
}
@ -81,7 +74,7 @@ func (m *MockSignerClient) DeriveSharedKey(ctx context.Context, ephemeralPubKey
}
// DeriveSharedKey indicates an expected call of DeriveSharedKey.
func (mr *MockSignerClientMockRecorder) DeriveSharedKey(ctx, ephemeralPubKey, keyLocator any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) DeriveSharedKey(ctx, ephemeralPubKey, keyLocator interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeriveSharedKey", reflect.TypeOf((*MockSignerClient)(nil).DeriveSharedKey), ctx, ephemeralPubKey, keyLocator)
}
@ -95,7 +88,7 @@ func (m *MockSignerClient) MuSig2Cleanup(ctx context.Context, sessionID [32]byte
}
// MuSig2Cleanup indicates an expected call of MuSig2Cleanup.
func (mr *MockSignerClientMockRecorder) MuSig2Cleanup(ctx, sessionID any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) MuSig2Cleanup(ctx, sessionID interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MuSig2Cleanup", reflect.TypeOf((*MockSignerClient)(nil).MuSig2Cleanup), ctx, sessionID)
}
@ -111,7 +104,7 @@ func (m *MockSignerClient) MuSig2CombineSig(ctx context.Context, sessionID [32]b
}
// MuSig2CombineSig indicates an expected call of MuSig2CombineSig.
func (mr *MockSignerClientMockRecorder) MuSig2CombineSig(ctx, sessionID, otherPartialSigs any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) MuSig2CombineSig(ctx, sessionID, otherPartialSigs interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MuSig2CombineSig", reflect.TypeOf((*MockSignerClient)(nil).MuSig2CombineSig), ctx, sessionID, otherPartialSigs)
}
@ -119,7 +112,7 @@ func (mr *MockSignerClientMockRecorder) MuSig2CombineSig(ctx, sessionID, otherPa
// MuSig2CreateSession mocks base method.
func (m *MockSignerClient) MuSig2CreateSession(ctx context.Context, version input.MuSig2Version, signerLoc *keychain.KeyLocator, signers [][]byte, opts ...lndclient.MuSig2SessionOpts) (*input.MuSig2SessionInfo, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, version, signerLoc, signers}
varargs := []interface{}{ctx, version, signerLoc, signers}
for _, a := range opts {
varargs = append(varargs, a)
}
@ -130,9 +123,9 @@ func (m *MockSignerClient) MuSig2CreateSession(ctx context.Context, version inpu
}
// MuSig2CreateSession indicates an expected call of MuSig2CreateSession.
func (mr *MockSignerClientMockRecorder) MuSig2CreateSession(ctx, version, signerLoc, signers any, opts ...any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) MuSig2CreateSession(ctx, version, signerLoc, signers interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, version, signerLoc, signers}, opts...)
varargs := append([]interface{}{ctx, version, signerLoc, signers}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MuSig2CreateSession", reflect.TypeOf((*MockSignerClient)(nil).MuSig2CreateSession), varargs...)
}
@ -146,7 +139,7 @@ func (m *MockSignerClient) MuSig2RegisterNonces(ctx context.Context, sessionID [
}
// MuSig2RegisterNonces indicates an expected call of MuSig2RegisterNonces.
func (mr *MockSignerClientMockRecorder) MuSig2RegisterNonces(ctx, sessionID, nonces any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) MuSig2RegisterNonces(ctx, sessionID, nonces interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MuSig2RegisterNonces", reflect.TypeOf((*MockSignerClient)(nil).MuSig2RegisterNonces), ctx, sessionID, nonces)
}
@ -161,31 +154,15 @@ func (m *MockSignerClient) MuSig2Sign(ctx context.Context, sessionID, message [3
}
// MuSig2Sign indicates an expected call of MuSig2Sign.
func (mr *MockSignerClientMockRecorder) MuSig2Sign(ctx, sessionID, message, cleanup any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) MuSig2Sign(ctx, sessionID, message, cleanup interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MuSig2Sign", reflect.TypeOf((*MockSignerClient)(nil).MuSig2Sign), ctx, sessionID, message, cleanup)
}
// RawClientWithMacAuth mocks base method.
func (m *MockSignerClient) RawClientWithMacAuth(parentCtx context.Context) (context.Context, time.Duration, signrpc.SignerClient) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RawClientWithMacAuth", parentCtx)
ret0, _ := ret[0].(context.Context)
ret1, _ := ret[1].(time.Duration)
ret2, _ := ret[2].(signrpc.SignerClient)
return ret0, ret1, ret2
}
// RawClientWithMacAuth indicates an expected call of RawClientWithMacAuth.
func (mr *MockSignerClientMockRecorder) RawClientWithMacAuth(parentCtx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RawClientWithMacAuth", reflect.TypeOf((*MockSignerClient)(nil).RawClientWithMacAuth), parentCtx)
}
// SignMessage mocks base method.
func (m *MockSignerClient) SignMessage(ctx context.Context, msg []byte, locator keychain.KeyLocator, opts ...lndclient.SignMessageOption) ([]byte, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, msg, locator}
varargs := []interface{}{ctx, msg, locator}
for _, a := range opts {
varargs = append(varargs, a)
}
@ -196,9 +173,9 @@ func (m *MockSignerClient) SignMessage(ctx context.Context, msg []byte, locator
}
// SignMessage indicates an expected call of SignMessage.
func (mr *MockSignerClientMockRecorder) SignMessage(ctx, msg, locator any, opts ...any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) SignMessage(ctx, msg, locator interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, msg, locator}, opts...)
varargs := append([]interface{}{ctx, msg, locator}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignMessage", reflect.TypeOf((*MockSignerClient)(nil).SignMessage), varargs...)
}
@ -212,30 +189,15 @@ func (m *MockSignerClient) SignOutputRaw(ctx context.Context, tx *wire.MsgTx, si
}
// SignOutputRaw indicates an expected call of SignOutputRaw.
func (mr *MockSignerClientMockRecorder) SignOutputRaw(ctx, tx, signDescriptors, prevOutputs any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) SignOutputRaw(ctx, tx, signDescriptors, prevOutputs interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignOutputRaw", reflect.TypeOf((*MockSignerClient)(nil).SignOutputRaw), ctx, tx, signDescriptors, prevOutputs)
}
// SignOutputRawKeyLocator mocks base method.
func (m *MockSignerClient) SignOutputRawKeyLocator(ctx context.Context, tx *wire.MsgTx, signDescriptors []*lndclient.SignDescriptor, prevOutputs []*wire.TxOut) ([][]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SignOutputRawKeyLocator", ctx, tx, signDescriptors, prevOutputs)
ret0, _ := ret[0].([][]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// SignOutputRawKeyLocator indicates an expected call of SignOutputRawKeyLocator.
func (mr *MockSignerClientMockRecorder) SignOutputRawKeyLocator(ctx, tx, signDescriptors, prevOutputs any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignOutputRawKeyLocator", reflect.TypeOf((*MockSignerClient)(nil).SignOutputRawKeyLocator), ctx, tx, signDescriptors, prevOutputs)
}
// VerifyMessage mocks base method.
func (m *MockSignerClient) VerifyMessage(ctx context.Context, msg, sig []byte, pubkey [33]byte, opts ...lndclient.VerifyMessageOption) (bool, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, msg, sig, pubkey}
varargs := []interface{}{ctx, msg, sig, pubkey}
for _, a := range opts {
varargs = append(varargs, a)
}
@ -246,9 +208,9 @@ func (m *MockSignerClient) VerifyMessage(ctx context.Context, msg, sig []byte, p
}
// VerifyMessage indicates an expected call of VerifyMessage.
func (mr *MockSignerClientMockRecorder) VerifyMessage(ctx, msg, sig, pubkey any, opts ...any) *gomock.Call {
func (mr *MockSignerClientMockRecorder) VerifyMessage(ctx, msg, sig, pubkey interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, msg, sig, pubkey}, opts...)
varargs := append([]interface{}{ctx, msg, sig, pubkey}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyMessage", reflect.TypeOf((*MockSignerClient)(nil).VerifyMessage), varargs...)
}
@ -276,22 +238,17 @@ func (m *MockWalletKitClient) EXPECT() *MockWalletKitClientMockRecorder {
}
// BumpFee mocks base method.
func (m *MockWalletKitClient) BumpFee(arg0 context.Context, arg1 wire.OutPoint, arg2 chainfee.SatPerKWeight, arg3 ...lndclient.BumpFeeOption) error {
func (m *MockWalletKitClient) BumpFee(arg0 context.Context, arg1 wire.OutPoint, arg2 chainfee.SatPerKWeight) error {
m.ctrl.T.Helper()
varargs := []any{arg0, arg1, arg2}
for _, a := range arg3 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "BumpFee", varargs...)
ret := m.ctrl.Call(m, "BumpFee", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// BumpFee indicates an expected call of BumpFee.
func (mr *MockWalletKitClientMockRecorder) BumpFee(arg0, arg1, arg2 any, arg3 ...any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) BumpFee(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{arg0, arg1, arg2}, arg3...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BumpFee", reflect.TypeOf((*MockWalletKitClient)(nil).BumpFee), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BumpFee", reflect.TypeOf((*MockWalletKitClient)(nil).BumpFee), arg0, arg1, arg2)
}
// DeriveKey mocks base method.
@ -304,7 +261,7 @@ func (m *MockWalletKitClient) DeriveKey(ctx context.Context, locator *keychain.K
}
// DeriveKey indicates an expected call of DeriveKey.
func (mr *MockWalletKitClientMockRecorder) DeriveKey(ctx, locator any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) DeriveKey(ctx, locator interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeriveKey", reflect.TypeOf((*MockWalletKitClient)(nil).DeriveKey), ctx, locator)
}
@ -319,7 +276,7 @@ func (m *MockWalletKitClient) DeriveNextKey(ctx context.Context, family int32) (
}
// DeriveNextKey indicates an expected call of DeriveNextKey.
func (mr *MockWalletKitClientMockRecorder) DeriveNextKey(ctx, family any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) DeriveNextKey(ctx, family interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeriveNextKey", reflect.TypeOf((*MockWalletKitClient)(nil).DeriveNextKey), ctx, family)
}
@ -334,7 +291,7 @@ func (m *MockWalletKitClient) EstimateFeeRate(ctx context.Context, confTarget in
}
// EstimateFeeRate indicates an expected call of EstimateFeeRate.
func (mr *MockWalletKitClientMockRecorder) EstimateFeeRate(ctx, confTarget any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) EstimateFeeRate(ctx, confTarget interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateFeeRate", reflect.TypeOf((*MockWalletKitClient)(nil).EstimateFeeRate), ctx, confTarget)
}
@ -350,7 +307,7 @@ func (m *MockWalletKitClient) FinalizePsbt(ctx context.Context, packet *psbt.Pac
}
// FinalizePsbt indicates an expected call of FinalizePsbt.
func (mr *MockWalletKitClientMockRecorder) FinalizePsbt(ctx, packet, account any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) FinalizePsbt(ctx, packet, account interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizePsbt", reflect.TypeOf((*MockWalletKitClient)(nil).FinalizePsbt), ctx, packet, account)
}
@ -367,7 +324,7 @@ func (m *MockWalletKitClient) FundPsbt(ctx context.Context, req *walletrpc.FundP
}
// FundPsbt indicates an expected call of FundPsbt.
func (mr *MockWalletKitClientMockRecorder) FundPsbt(ctx, req any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) FundPsbt(ctx, req interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FundPsbt", reflect.TypeOf((*MockWalletKitClient)(nil).FundPsbt), ctx, req)
}
@ -381,7 +338,7 @@ func (m *MockWalletKitClient) ImportPublicKey(ctx context.Context, pubkey *btcec
}
// ImportPublicKey indicates an expected call of ImportPublicKey.
func (mr *MockWalletKitClientMockRecorder) ImportPublicKey(ctx, pubkey, addrType any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ImportPublicKey(ctx, pubkey, addrType interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportPublicKey", reflect.TypeOf((*MockWalletKitClient)(nil).ImportPublicKey), ctx, pubkey, addrType)
}
@ -396,7 +353,7 @@ func (m *MockWalletKitClient) ImportTaprootScript(ctx context.Context, tapscript
}
// ImportTaprootScript indicates an expected call of ImportTaprootScript.
func (mr *MockWalletKitClientMockRecorder) ImportTaprootScript(ctx, tapscript any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ImportTaprootScript(ctx, tapscript interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportTaprootScript", reflect.TypeOf((*MockWalletKitClient)(nil).ImportTaprootScript), ctx, tapscript)
}
@ -411,7 +368,7 @@ func (m *MockWalletKitClient) LeaseOutput(ctx context.Context, lockID wtxmgr.Loc
}
// LeaseOutput indicates an expected call of LeaseOutput.
func (mr *MockWalletKitClientMockRecorder) LeaseOutput(ctx, lockID, op, leaseTime any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) LeaseOutput(ctx, lockID, op, leaseTime interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LeaseOutput", reflect.TypeOf((*MockWalletKitClient)(nil).LeaseOutput), ctx, lockID, op, leaseTime)
}
@ -426,7 +383,7 @@ func (m *MockWalletKitClient) ListAccounts(ctx context.Context, name string, add
}
// ListAccounts indicates an expected call of ListAccounts.
func (mr *MockWalletKitClientMockRecorder) ListAccounts(ctx, name, addressType any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ListAccounts(ctx, name, addressType interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccounts", reflect.TypeOf((*MockWalletKitClient)(nil).ListAccounts), ctx, name, addressType)
}
@ -441,45 +398,45 @@ func (m *MockWalletKitClient) ListLeases(ctx context.Context) ([]lndclient.Lease
}
// ListLeases indicates an expected call of ListLeases.
func (mr *MockWalletKitClientMockRecorder) ListLeases(ctx any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ListLeases(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLeases", reflect.TypeOf((*MockWalletKitClient)(nil).ListLeases), ctx)
}
// ListSweeps mocks base method.
func (m *MockWalletKitClient) ListSweeps(ctx context.Context, startHeight int32) ([]string, error) {
func (m *MockWalletKitClient) ListSweeps(ctx context.Context) ([]string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListSweeps", ctx, startHeight)
ret := m.ctrl.Call(m, "ListSweeps", ctx)
ret0, _ := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ListSweeps indicates an expected call of ListSweeps.
func (mr *MockWalletKitClientMockRecorder) ListSweeps(ctx, startHeight any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ListSweeps(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSweeps", reflect.TypeOf((*MockWalletKitClient)(nil).ListSweeps), ctx, startHeight)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSweeps", reflect.TypeOf((*MockWalletKitClient)(nil).ListSweeps), ctx)
}
// ListSweepsVerbose mocks base method.
func (m *MockWalletKitClient) ListSweepsVerbose(ctx context.Context, startHeight int32) ([]lnwallet.TransactionDetail, error) {
func (m *MockWalletKitClient) ListSweepsVerbose(ctx context.Context) ([]lnwallet.TransactionDetail, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListSweepsVerbose", ctx, startHeight)
ret := m.ctrl.Call(m, "ListSweepsVerbose", ctx)
ret0, _ := ret[0].([]lnwallet.TransactionDetail)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ListSweepsVerbose indicates an expected call of ListSweepsVerbose.
func (mr *MockWalletKitClientMockRecorder) ListSweepsVerbose(ctx, startHeight any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ListSweepsVerbose(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSweepsVerbose", reflect.TypeOf((*MockWalletKitClient)(nil).ListSweepsVerbose), ctx, startHeight)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSweepsVerbose", reflect.TypeOf((*MockWalletKitClient)(nil).ListSweepsVerbose), ctx)
}
// ListUnspent mocks base method.
func (m *MockWalletKitClient) ListUnspent(ctx context.Context, minConfs, maxConfs int32, opts ...lndclient.ListUnspentOption) ([]*lnwallet.Utxo, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, minConfs, maxConfs}
varargs := []interface{}{ctx, minConfs, maxConfs}
for _, a := range opts {
varargs = append(varargs, a)
}
@ -490,27 +447,12 @@ func (m *MockWalletKitClient) ListUnspent(ctx context.Context, minConfs, maxConf
}
// ListUnspent indicates an expected call of ListUnspent.
func (mr *MockWalletKitClientMockRecorder) ListUnspent(ctx, minConfs, maxConfs any, opts ...any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ListUnspent(ctx, minConfs, maxConfs interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, minConfs, maxConfs}, opts...)
varargs := append([]interface{}{ctx, minConfs, maxConfs}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUnspent", reflect.TypeOf((*MockWalletKitClient)(nil).ListUnspent), varargs...)
}
// MinRelayFee mocks base method.
func (m *MockWalletKitClient) MinRelayFee(ctx context.Context) (chainfee.SatPerKWeight, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "MinRelayFee", ctx)
ret0, _ := ret[0].(chainfee.SatPerKWeight)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// MinRelayFee indicates an expected call of MinRelayFee.
func (mr *MockWalletKitClientMockRecorder) MinRelayFee(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MinRelayFee", reflect.TypeOf((*MockWalletKitClient)(nil).MinRelayFee), ctx)
}
// NextAddr mocks base method.
func (m *MockWalletKitClient) NextAddr(ctx context.Context, accountName string, addressType walletrpc.AddressType, change bool) (btcutil.Address, error) {
m.ctrl.T.Helper()
@ -521,7 +463,7 @@ func (m *MockWalletKitClient) NextAddr(ctx context.Context, accountName string,
}
// NextAddr indicates an expected call of NextAddr.
func (mr *MockWalletKitClientMockRecorder) NextAddr(ctx, accountName, addressType, change any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) NextAddr(ctx, accountName, addressType, change interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextAddr", reflect.TypeOf((*MockWalletKitClient)(nil).NextAddr), ctx, accountName, addressType, change)
}
@ -535,27 +477,11 @@ func (m *MockWalletKitClient) PublishTransaction(ctx context.Context, tx *wire.M
}
// PublishTransaction indicates an expected call of PublishTransaction.
func (mr *MockWalletKitClientMockRecorder) PublishTransaction(ctx, tx, label any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) PublishTransaction(ctx, tx, label interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishTransaction", reflect.TypeOf((*MockWalletKitClient)(nil).PublishTransaction), ctx, tx, label)
}
// RawClientWithMacAuth mocks base method.
func (m *MockWalletKitClient) RawClientWithMacAuth(parentCtx context.Context) (context.Context, time.Duration, walletrpc.WalletKitClient) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RawClientWithMacAuth", parentCtx)
ret0, _ := ret[0].(context.Context)
ret1, _ := ret[1].(time.Duration)
ret2, _ := ret[2].(walletrpc.WalletKitClient)
return ret0, ret1, ret2
}
// RawClientWithMacAuth indicates an expected call of RawClientWithMacAuth.
func (mr *MockWalletKitClientMockRecorder) RawClientWithMacAuth(parentCtx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RawClientWithMacAuth", reflect.TypeOf((*MockWalletKitClient)(nil).RawClientWithMacAuth), parentCtx)
}
// ReleaseOutput mocks base method.
func (m *MockWalletKitClient) ReleaseOutput(ctx context.Context, lockID wtxmgr.LockID, op wire.OutPoint) error {
m.ctrl.T.Helper()
@ -565,7 +491,7 @@ func (m *MockWalletKitClient) ReleaseOutput(ctx context.Context, lockID wtxmgr.L
}
// ReleaseOutput indicates an expected call of ReleaseOutput.
func (mr *MockWalletKitClientMockRecorder) ReleaseOutput(ctx, lockID, op any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) ReleaseOutput(ctx, lockID, op interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReleaseOutput", reflect.TypeOf((*MockWalletKitClient)(nil).ReleaseOutput), ctx, lockID, op)
}
@ -580,7 +506,7 @@ func (m *MockWalletKitClient) SendOutputs(ctx context.Context, outputs []*wire.T
}
// SendOutputs indicates an expected call of SendOutputs.
func (mr *MockWalletKitClientMockRecorder) SendOutputs(ctx, outputs, feeRate, label any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) SendOutputs(ctx, outputs, feeRate, label interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendOutputs", reflect.TypeOf((*MockWalletKitClient)(nil).SendOutputs), ctx, outputs, feeRate, label)
}
@ -595,7 +521,7 @@ func (m *MockWalletKitClient) SignPsbt(ctx context.Context, packet *psbt.Packet)
}
// SignPsbt indicates an expected call of SignPsbt.
func (mr *MockWalletKitClientMockRecorder) SignPsbt(ctx, packet any) *gomock.Call {
func (mr *MockWalletKitClientMockRecorder) SignPsbt(ctx, packet interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignPsbt", reflect.TypeOf((*MockWalletKitClient)(nil).SignPsbt), ctx, packet)
}
@ -623,22 +549,6 @@ func (m *MockChainNotifierClient) EXPECT() *MockChainNotifierClientMockRecorder
return m.recorder
}
// RawClientWithMacAuth mocks base method.
func (m *MockChainNotifierClient) RawClientWithMacAuth(parentCtx context.Context) (context.Context, time.Duration, chainrpc.ChainNotifierClient) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RawClientWithMacAuth", parentCtx)
ret0, _ := ret[0].(context.Context)
ret1, _ := ret[1].(time.Duration)
ret2, _ := ret[2].(chainrpc.ChainNotifierClient)
return ret0, ret1, ret2
}
// RawClientWithMacAuth indicates an expected call of RawClientWithMacAuth.
func (mr *MockChainNotifierClientMockRecorder) RawClientWithMacAuth(parentCtx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RawClientWithMacAuth", reflect.TypeOf((*MockChainNotifierClient)(nil).RawClientWithMacAuth), parentCtx)
}
// RegisterBlockEpochNtfn mocks base method.
func (m *MockChainNotifierClient) RegisterBlockEpochNtfn(ctx context.Context) (chan int32, chan error, error) {
m.ctrl.T.Helper()
@ -650,7 +560,7 @@ func (m *MockChainNotifierClient) RegisterBlockEpochNtfn(ctx context.Context) (c
}
// RegisterBlockEpochNtfn indicates an expected call of RegisterBlockEpochNtfn.
func (mr *MockChainNotifierClientMockRecorder) RegisterBlockEpochNtfn(ctx any) *gomock.Call {
func (mr *MockChainNotifierClientMockRecorder) RegisterBlockEpochNtfn(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterBlockEpochNtfn", reflect.TypeOf((*MockChainNotifierClient)(nil).RegisterBlockEpochNtfn), ctx)
}
@ -658,7 +568,7 @@ func (mr *MockChainNotifierClientMockRecorder) RegisterBlockEpochNtfn(ctx any) *
// RegisterConfirmationsNtfn mocks base method.
func (m *MockChainNotifierClient) RegisterConfirmationsNtfn(ctx context.Context, txid *chainhash.Hash, pkScript []byte, numConfs, heightHint int32, opts ...lndclient.NotifierOption) (chan *chainntnfs.TxConfirmation, chan error, error) {
m.ctrl.T.Helper()
varargs := []any{ctx, txid, pkScript, numConfs, heightHint}
varargs := []interface{}{ctx, txid, pkScript, numConfs, heightHint}
for _, a := range opts {
varargs = append(varargs, a)
}
@ -670,9 +580,9 @@ func (m *MockChainNotifierClient) RegisterConfirmationsNtfn(ctx context.Context,
}
// RegisterConfirmationsNtfn indicates an expected call of RegisterConfirmationsNtfn.
func (mr *MockChainNotifierClientMockRecorder) RegisterConfirmationsNtfn(ctx, txid, pkScript, numConfs, heightHint any, opts ...any) *gomock.Call {
func (mr *MockChainNotifierClientMockRecorder) RegisterConfirmationsNtfn(ctx, txid, pkScript, numConfs, heightHint interface{}, opts ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, txid, pkScript, numConfs, heightHint}, opts...)
varargs := append([]interface{}{ctx, txid, pkScript, numConfs, heightHint}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterConfirmationsNtfn", reflect.TypeOf((*MockChainNotifierClient)(nil).RegisterConfirmationsNtfn), varargs...)
}
@ -687,7 +597,7 @@ func (m *MockChainNotifierClient) RegisterSpendNtfn(ctx context.Context, outpoin
}
// RegisterSpendNtfn indicates an expected call of RegisterSpendNtfn.
func (mr *MockChainNotifierClientMockRecorder) RegisterSpendNtfn(ctx, outpoint, pkScript, heightHint any) *gomock.Call {
func (mr *MockChainNotifierClientMockRecorder) RegisterSpendNtfn(ctx, outpoint, pkScript, heightHint interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSpendNtfn", reflect.TypeOf((*MockChainNotifierClient)(nil).RegisterSpendNtfn), ctx, outpoint, pkScript, heightHint)
}

View file

@ -3,14 +3,13 @@ package test
import (
"bytes"
"context"
"time"
"fmt"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/wire"
"github.com/lightninglabs/lndclient"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
)
var (
@ -38,8 +37,6 @@ func NewMockSigner() *MockSigner {
}
type MockSigner struct {
lndclient.SignerClient
SignOutputRawChannel chan SignOutputRawRequest
Height int32
@ -48,12 +45,7 @@ type MockSigner struct {
SignatureMsg string
}
func (s *MockSigner) RawClientWithMacAuth(
ctx context.Context) (context.Context, time.Duration,
signrpc.SignerClient) {
return ctx, 0, nil
}
var _ lndclient.SignerClient = (*MockSigner)(nil)
func (s *MockSigner) SignOutputRaw(_ context.Context, tx *wire.MsgTx,
signDescriptors []*lndclient.SignDescriptor,
@ -69,6 +61,12 @@ func (s *MockSigner) SignOutputRaw(_ context.Context, tx *wire.MsgTx,
return rawSigs, nil
}
func (s *MockSigner) ComputeInputScript(context.Context, *wire.MsgTx,
[]*lndclient.SignDescriptor, []*wire.TxOut) ([]*input.Script, error) {
return nil, fmt.Errorf("unimplemented")
}
func (s *MockSigner) SignMessage(_ context.Context, _ []byte,
_ keychain.KeyLocator, _ ...lndclient.SignMessageOption) ([]byte,
error) {

View file

@ -29,8 +29,6 @@ func NewMockWalletKit() *MockWalletKit {
}
type MockWalletKit struct {
lndclient.WalletKitClient
keyIndex int32
feeEstimates map[int32]chainfee.SatPerKWeight
@ -44,13 +42,6 @@ type MockWalletKit struct {
var _ lndclient.WalletKitClient = (*MockWalletKit)(nil)
func (m *MockWalletKit) RawClientWithMacAuth(
ctx context.Context) (context.Context, time.Duration,
walletrpc.WalletKitClient) {
return ctx, 0, nil
}
func (m *MockWalletKit) ListUnspent(context.Context, int32, int32,
...lndclient.ListUnspentOption) ([]*lnwallet.Utxo, error) {
@ -165,12 +156,12 @@ func (m *MockWalletKit) EstimateFeeRate(_ context.Context, confTarget int32) (
}
// ListSweeps returns a list of the sweep transaction ids known to our node.
func (m *MockWalletKit) ListSweeps(context.Context, int32) ([]string, error) {
func (m *MockWalletKit) ListSweeps(_ context.Context) ([]string, error) {
return m.Sweeps, nil
}
func (m *MockWalletKit) ListSweepsVerbose(context.Context,
int32) ([]lnwallet.TransactionDetail, error) {
func (m *MockWalletKit) ListSweepsVerbose(
_ context.Context) ([]lnwallet.TransactionDetail, error) {
return nil, nil
}
@ -182,6 +173,12 @@ func (m *MockWalletKit) AddTx(tx *wire.MsgTx) {
m.lock.Unlock()
}
func (m *MockWalletKit) BumpFee(context.Context, wire.OutPoint,
chainfee.SatPerKWeight) error {
panic("unimplemented")
}
// ListAccounts retrieves all accounts belonging to the wallet by default.
// Optional name and addressType can be provided to filter through all of the
// wallet accounts and return only those matching.

10
log.go
View file

@ -5,7 +5,7 @@ package pool
import (
"context"
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightninglabs/aperture/l402"
"github.com/lightninglabs/lndclient"
"github.com/lightninglabs/pool/account"
@ -26,18 +26,16 @@ const Subsystem = "POOL"
var (
logWriter = build.NewRotatingLogWriter()
subLogMgr = build.NewSubLoggerManager()
log = build.NewSubLogger(Subsystem, nil)
rpcLog = build.NewSubLogger("RPCS", nil)
sdcrLog = build.NewSubLogger("SDCR", nil)
)
// SetupLoggers initializes all package-global logger variables.
func SetupLoggers(root *build.SubLoggerManager, intercept signal.Interceptor) {
func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) {
genLogger := genSubLogger(root, intercept)
subLogMgr = root
logWriter = root
log = build.NewSubLogger(Subsystem, genLogger)
rpcLog = build.NewSubLogger("RPCS", genLogger)
sdcrLog = build.NewSubLogger("SDCR", genLogger)
@ -64,7 +62,7 @@ func SetupLoggers(root *build.SubLoggerManager, intercept signal.Interceptor) {
// genSubLogger creates a logger for a subsystem. We provide an instance of
// a signal.Interceptor to be able to shutdown in the case of a critical error.
func genSubLogger(root *build.SubLoggerManager,
func genSubLogger(root *build.RotatingLogWriter,
interceptor signal.Interceptor) func(string) btclog.Logger {
// Create a shutdown function which will request shutdown from our

View file

@ -1,10 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: interfaces.go
//
// Generated by this command:
//
// mockgen -source=interfaces.go -package=pool -destination=mock_interfaces.go
//
// Package pool is a generated GoMock package.
package pool
@ -13,9 +8,9 @@ import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
account "github.com/lightninglabs/pool/account"
poolrpc "github.com/lightninglabs/pool/poolrpc"
gomock "go.uber.org/mock/gomock"
)
// MockMarshaler is a mock of Marshaler interface.
@ -51,7 +46,7 @@ func (m *MockMarshaler) MarshallAccountsWithAvailableBalance(ctx context.Context
}
// MarshallAccountsWithAvailableBalance indicates an expected call of MarshallAccountsWithAvailableBalance.
func (mr *MockMarshalerMockRecorder) MarshallAccountsWithAvailableBalance(ctx, accounts any) *gomock.Call {
func (mr *MockMarshalerMockRecorder) MarshallAccountsWithAvailableBalance(ctx, accounts interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarshallAccountsWithAvailableBalance", reflect.TypeOf((*MockMarshaler)(nil).MarshallAccountsWithAvailableBalance), ctx, accounts)
}

View file

@ -1,7 +1,7 @@
package order
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -1,10 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: order/interfaces.go
//
// Generated by this command:
//
// mockgen -source=order/interfaces.go -package=order -destination=order/mock_interfaces.go
//
// Package order is a generated GoMock package.
package order
@ -14,9 +9,9 @@ import (
reflect "reflect"
btcutil "github.com/btcsuite/btcd/btcutil"
gomock "github.com/golang/mock/gomock"
account "github.com/lightninglabs/pool/account"
terms "github.com/lightninglabs/pool/terms"
gomock "go.uber.org/mock/gomock"
)
// MockOrder is a mock of Order interface.
@ -94,7 +89,7 @@ func (m *MockOrder) ReservedValue(feeSchedule terms.FeeSchedule, accountVersion
}
// ReservedValue indicates an expected call of ReservedValue.
func (mr *MockOrderMockRecorder) ReservedValue(feeSchedule, accountVersion any) *gomock.Call {
func (mr *MockOrderMockRecorder) ReservedValue(feeSchedule, accountVersion interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReservedValue", reflect.TypeOf((*MockOrder)(nil).ReservedValue), feeSchedule, accountVersion)
}
@ -145,7 +140,7 @@ func (m *MockStore) DeleteOrder(arg0 Nonce) error {
}
// DeleteOrder indicates an expected call of DeleteOrder.
func (mr *MockStoreMockRecorder) DeleteOrder(arg0 any) *gomock.Call {
func (mr *MockStoreMockRecorder) DeleteOrder(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOrder", reflect.TypeOf((*MockStore)(nil).DeleteOrder), arg0)
}
@ -160,7 +155,7 @@ func (m *MockStore) GetOrder(arg0 Nonce) (Order, error) {
}
// GetOrder indicates an expected call of GetOrder.
func (mr *MockStoreMockRecorder) GetOrder(arg0 any) *gomock.Call {
func (mr *MockStoreMockRecorder) GetOrder(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrder", reflect.TypeOf((*MockStore)(nil).GetOrder), arg0)
}
@ -203,7 +198,7 @@ func (m *MockStore) StorePendingBatch(arg0 *Batch, orders []Nonce, orderModifier
}
// StorePendingBatch indicates an expected call of StorePendingBatch.
func (mr *MockStoreMockRecorder) StorePendingBatch(arg0, orders, orderModifiers, accounts, accountModifiers any) *gomock.Call {
func (mr *MockStoreMockRecorder) StorePendingBatch(arg0, orders, orderModifiers, accounts, accountModifiers interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorePendingBatch", reflect.TypeOf((*MockStore)(nil).StorePendingBatch), arg0, orders, orderModifiers, accounts, accountModifiers)
}
@ -217,7 +212,7 @@ func (m *MockStore) SubmitOrder(arg0 Order) error {
}
// SubmitOrder indicates an expected call of SubmitOrder.
func (mr *MockStoreMockRecorder) SubmitOrder(arg0 any) *gomock.Call {
func (mr *MockStoreMockRecorder) SubmitOrder(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitOrder", reflect.TypeOf((*MockStore)(nil).SubmitOrder), arg0)
}
@ -225,7 +220,7 @@ func (mr *MockStoreMockRecorder) SubmitOrder(arg0 any) *gomock.Call {
// UpdateOrder mocks base method.
func (m *MockStore) UpdateOrder(arg0 Nonce, arg1 ...Modifier) error {
m.ctrl.T.Helper()
varargs := []any{arg0}
varargs := []interface{}{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
@ -235,9 +230,9 @@ func (m *MockStore) UpdateOrder(arg0 Nonce, arg1 ...Modifier) error {
}
// UpdateOrder indicates an expected call of UpdateOrder.
func (mr *MockStoreMockRecorder) UpdateOrder(arg0 any, arg1 ...any) *gomock.Call {
func (mr *MockStoreMockRecorder) UpdateOrder(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{arg0}, arg1...)
varargs := append([]interface{}{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOrder", reflect.TypeOf((*MockStore)(nil).UpdateOrder), varargs...)
}
@ -250,7 +245,7 @@ func (m *MockStore) UpdateOrders(arg0 []Nonce, arg1 [][]Modifier) error {
}
// UpdateOrders indicates an expected call of UpdateOrders.
func (mr *MockStoreMockRecorder) UpdateOrders(arg0, arg1 any) *gomock.Call {
func (mr *MockStoreMockRecorder) UpdateOrders(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOrders", reflect.TypeOf((*MockStore)(nil).UpdateOrders), arg0, arg1)
}
@ -287,7 +282,7 @@ func (m *MockManager) BatchFinalize(batchID BatchID) error {
}
// BatchFinalize indicates an expected call of BatchFinalize.
func (mr *MockManagerMockRecorder) BatchFinalize(batchID any) *gomock.Call {
func (mr *MockManagerMockRecorder) BatchFinalize(batchID interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchFinalize", reflect.TypeOf((*MockManager)(nil).BatchFinalize), batchID)
}
@ -331,7 +326,7 @@ func (m *MockManager) OrderMatchValidate(batch *Batch, bestHeight uint32) error
}
// OrderMatchValidate indicates an expected call of OrderMatchValidate.
func (mr *MockManagerMockRecorder) OrderMatchValidate(batch, bestHeight any) *gomock.Call {
func (mr *MockManagerMockRecorder) OrderMatchValidate(batch, bestHeight interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OrderMatchValidate", reflect.TypeOf((*MockManager)(nil).OrderMatchValidate), batch, bestHeight)
}
@ -375,7 +370,7 @@ func (m *MockManager) PrepareOrder(ctx context.Context, order Order, acct *accou
}
// PrepareOrder indicates an expected call of PrepareOrder.
func (mr *MockManagerMockRecorder) PrepareOrder(ctx, order, acct, terms any) *gomock.Call {
func (mr *MockManagerMockRecorder) PrepareOrder(ctx, order, acct, terms interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareOrder", reflect.TypeOf((*MockManager)(nil).PrepareOrder), ctx, order, acct, terms)
}

View file

@ -7,7 +7,6 @@ import (
"github.com/lightninglabs/pool/poolscript"
"github.com/lightninglabs/pool/terms"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
)
@ -100,7 +99,7 @@ func EstimateTraderFee(numTraderChans uint32, feeRate chainfee.SatPerKWeight,
weightEstimate += poolscript.MultiSigWitnessSize
}
return feeRate.FeeForWeight(lntypes.WeightUnit(weightEstimate))
return feeRate.FeeForWeight(weightEstimate)
}
// Quote is a struct holding the result of an order quote calculation.
@ -283,7 +282,7 @@ func minNoDustAccountSize() btcutil.Amount {
weightEstimator.AddWitnessInput(poolscript.MultiSigWitnessSize)
weightEstimator.AddP2WKHOutput()
minimumFee := chainfee.FeePerKwFloor.FeeForWeight(
weightEstimator.Weight(),
int64(weightEstimator.Weight()),
)
// After paying the fee, more than dust needs to remain, otherwise it

View file

@ -1,4 +1,4 @@
package poolrpc
package perms
import "gopkg.in/macaroon-bakery.v2/bakery"

View file

@ -1,9 +1,9 @@
FROM golang:1.22.3-bookworm
FROM golang:1.19.4-buster
RUN apt-get update && apt-get install -y \
git \
protobuf-compiler='3.21.12*' \
clang-format='1:14.0*'
protobuf-compiler='3.6*' \
clang-format='1:7.0*'
# We don't want any default values for these variables to make sure they're
# explicitly provided by parsing the go.mod file. Otherwise we might forget to

View file

@ -3,27 +3,14 @@ package poolrpc
import (
"fmt"
"google.golang.org/protobuf/encoding/protojson"
"github.com/lightningnetwork/lnd/lnrpc"
"google.golang.org/protobuf/proto"
)
var (
// ProtoJSONMarshalOpts is a struct that holds the default marshal
// options for marshaling protobuf messages into JSON in a
// human-readable way. This should only be used in the CLI and in
// integration tests.
ProtoJSONMarshalOpts = &protojson.MarshalOptions{
EmitUnpopulated: true,
UseProtoNames: true,
Indent: " ",
UseHexForBytes: true,
}
)
// PrintMsg prints a protobuf message as JSON, suitable for logging (without any
// indentation).
func PrintMsg(message proto.Message) string {
jsonBytes, err := ProtoJSONMarshalOpts.Marshal(message)
jsonBytes, err := lnrpc.ProtoJSONMarshalOpts.Marshal(message)
if err != nil {
return fmt.Sprintf("<unable to decode proto msg: %v>", err)
}

View file

@ -1,23 +0,0 @@
module github.com/lightninglabs/pool/poolrpc
require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
github.com/lightninglabs/pool/auctioneerrpc v1.1.2
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
)
require google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
require (
golang.org/x/net v0.38.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect; indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
)
replace github.com/lightninglabs/pool/auctioneerrpc => ../auctioneerrpc
replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display
go 1.23.6

View file

@ -1,18 +0,0 @@
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display h1:w7FM5LH9Z6CpKxl13mS48idsu6F+cEZf0lkyiV+Dq9g=
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8=
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v3.21.12
// protoc-gen-go v1.31.0
// protoc v3.6.1
// source: trader.proto
package poolrpc
@ -6230,7 +6230,7 @@ func file_trader_proto_rawDescGZIP() []byte {
var file_trader_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_trader_proto_msgTypes = make([]protoimpl.MessageInfo, 71)
var file_trader_proto_goTypes = []any{
var file_trader_proto_goTypes = []interface{}{
(AccountVersion)(0), // 0: poolrpc.AccountVersion
(AccountState)(0), // 1: poolrpc.AccountState
(MatchState)(0), // 2: poolrpc.MatchState
@ -6449,7 +6449,7 @@ func file_trader_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_trader_proto_msgTypes[0].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InitAccountRequest); i {
case 0:
return &v.state
@ -6461,7 +6461,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[1].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QuoteAccountRequest); i {
case 0:
return &v.state
@ -6473,7 +6473,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[2].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QuoteAccountResponse); i {
case 0:
return &v.state
@ -6485,7 +6485,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[3].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListAccountsRequest); i {
case 0:
return &v.state
@ -6497,7 +6497,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[4].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListAccountsResponse); i {
case 0:
return &v.state
@ -6509,7 +6509,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[5].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Output); i {
case 0:
return &v.state
@ -6521,7 +6521,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[6].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OutputWithFee); i {
case 0:
return &v.state
@ -6533,7 +6533,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[7].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OutputsWithImplicitFee); i {
case 0:
return &v.state
@ -6545,7 +6545,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[8].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CloseAccountRequest); i {
case 0:
return &v.state
@ -6557,7 +6557,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[9].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CloseAccountResponse); i {
case 0:
return &v.state
@ -6569,7 +6569,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[10].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WithdrawAccountRequest); i {
case 0:
return &v.state
@ -6581,7 +6581,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[11].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WithdrawAccountResponse); i {
case 0:
return &v.state
@ -6593,7 +6593,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[12].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DepositAccountRequest); i {
case 0:
return &v.state
@ -6605,7 +6605,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[13].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DepositAccountResponse); i {
case 0:
return &v.state
@ -6617,7 +6617,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[14].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RenewAccountRequest); i {
case 0:
return &v.state
@ -6629,7 +6629,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[15].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RenewAccountResponse); i {
case 0:
return &v.state
@ -6641,7 +6641,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[16].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BumpAccountFeeRequest); i {
case 0:
return &v.state
@ -6653,7 +6653,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[17].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BumpAccountFeeResponse); i {
case 0:
return &v.state
@ -6665,7 +6665,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[18].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Account); i {
case 0:
return &v.state
@ -6677,7 +6677,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[19].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubmitOrderRequest); i {
case 0:
return &v.state
@ -6689,7 +6689,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[20].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubmitOrderResponse); i {
case 0:
return &v.state
@ -6701,7 +6701,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[21].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListOrdersRequest); i {
case 0:
return &v.state
@ -6713,7 +6713,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[22].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListOrdersResponse); i {
case 0:
return &v.state
@ -6725,7 +6725,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[23].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CancelOrderRequest); i {
case 0:
return &v.state
@ -6737,7 +6737,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[24].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CancelOrderResponse); i {
case 0:
return &v.state
@ -6749,7 +6749,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[25].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Order); i {
case 0:
return &v.state
@ -6761,7 +6761,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[26].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Bid); i {
case 0:
return &v.state
@ -6773,7 +6773,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[27].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Ask); i {
case 0:
return &v.state
@ -6785,7 +6785,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[28].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QuoteOrderRequest); i {
case 0:
return &v.state
@ -6797,7 +6797,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[29].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QuoteOrderResponse); i {
case 0:
return &v.state
@ -6809,7 +6809,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[30].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderEvent); i {
case 0:
return &v.state
@ -6821,7 +6821,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[31].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdatedEvent); i {
case 0:
return &v.state
@ -6833,7 +6833,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[32].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MatchEvent); i {
case 0:
return &v.state
@ -6845,7 +6845,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[33].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RecoverAccountsRequest); i {
case 0:
return &v.state
@ -6857,7 +6857,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[34].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RecoverAccountsResponse); i {
case 0:
return &v.state
@ -6869,7 +6869,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[35].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountModificationFeesRequest); i {
case 0:
return &v.state
@ -6881,7 +6881,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[36].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountModificationFee); i {
case 0:
return &v.state
@ -6893,7 +6893,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[37].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListOfAccountModificationFees); i {
case 0:
return &v.state
@ -6905,7 +6905,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[38].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AccountModificationFeesResponse); i {
case 0:
return &v.state
@ -6917,7 +6917,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[39].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuctionFeeRequest); i {
case 0:
return &v.state
@ -6929,7 +6929,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[40].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuctionFeeResponse); i {
case 0:
return &v.state
@ -6941,7 +6941,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[41].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Lease); i {
case 0:
return &v.state
@ -6953,7 +6953,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[42].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LeasesRequest); i {
case 0:
return &v.state
@ -6965,7 +6965,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[43].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LeasesResponse); i {
case 0:
return &v.state
@ -6977,7 +6977,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[44].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TokensRequest); i {
case 0:
return &v.state
@ -6989,7 +6989,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[45].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TokensResponse); i {
case 0:
return &v.state
@ -7001,7 +7001,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[46].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LsatToken); i {
case 0:
return &v.state
@ -7013,7 +7013,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[47].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LeaseDurationRequest); i {
case 0:
return &v.state
@ -7025,7 +7025,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[48].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LeaseDurationResponse); i {
case 0:
return &v.state
@ -7037,7 +7037,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[49].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NextBatchInfoRequest); i {
case 0:
return &v.state
@ -7049,7 +7049,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[50].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NextBatchInfoResponse); i {
case 0:
return &v.state
@ -7061,7 +7061,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[51].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeRatingRequest); i {
case 0:
return &v.state
@ -7073,7 +7073,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[52].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeRatingResponse); i {
case 0:
return &v.state
@ -7085,7 +7085,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[53].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetInfoRequest); i {
case 0:
return &v.state
@ -7097,7 +7097,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[54].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetInfoResponse); i {
case 0:
return &v.state
@ -7109,7 +7109,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[55].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StopDaemonRequest); i {
case 0:
return &v.state
@ -7121,7 +7121,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[56].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StopDaemonResponse); i {
case 0:
return &v.state
@ -7133,7 +7133,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[57].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OfferSidecarRequest); i {
case 0:
return &v.state
@ -7145,7 +7145,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[58].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SidecarTicket); i {
case 0:
return &v.state
@ -7157,7 +7157,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[59].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DecodedSidecarTicket); i {
case 0:
return &v.state
@ -7169,7 +7169,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[60].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterSidecarRequest); i {
case 0:
return &v.state
@ -7181,7 +7181,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[61].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ExpectSidecarChannelRequest); i {
case 0:
return &v.state
@ -7193,7 +7193,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[62].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ExpectSidecarChannelResponse); i {
case 0:
return &v.state
@ -7205,7 +7205,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[63].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListSidecarsRequest); i {
case 0:
return &v.state
@ -7217,7 +7217,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[64].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListSidecarsResponse); i {
case 0:
return &v.state
@ -7229,7 +7229,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[65].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CancelSidecarRequest); i {
case 0:
return &v.state
@ -7241,7 +7241,7 @@ func file_trader_proto_init() {
return nil
}
}
file_trader_proto_msgTypes[66].Exporter = func(v any, i int) any {
file_trader_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CancelSidecarResponse); i {
case 0:
return &v.state
@ -7254,48 +7254,48 @@ func file_trader_proto_init() {
}
}
}
file_trader_proto_msgTypes[0].OneofWrappers = []any{
file_trader_proto_msgTypes[0].OneofWrappers = []interface{}{
(*InitAccountRequest_AbsoluteHeight)(nil),
(*InitAccountRequest_RelativeHeight)(nil),
(*InitAccountRequest_ConfTarget)(nil),
(*InitAccountRequest_FeeRateSatPerKw)(nil),
}
file_trader_proto_msgTypes[1].OneofWrappers = []any{
file_trader_proto_msgTypes[1].OneofWrappers = []interface{}{
(*QuoteAccountRequest_ConfTarget)(nil),
}
file_trader_proto_msgTypes[6].OneofWrappers = []any{
file_trader_proto_msgTypes[6].OneofWrappers = []interface{}{
(*OutputWithFee_ConfTarget)(nil),
(*OutputWithFee_FeeRateSatPerKw)(nil),
}
file_trader_proto_msgTypes[8].OneofWrappers = []any{
file_trader_proto_msgTypes[8].OneofWrappers = []interface{}{
(*CloseAccountRequest_OutputWithFee)(nil),
(*CloseAccountRequest_Outputs)(nil),
}
file_trader_proto_msgTypes[10].OneofWrappers = []any{
file_trader_proto_msgTypes[10].OneofWrappers = []interface{}{
(*WithdrawAccountRequest_AbsoluteExpiry)(nil),
(*WithdrawAccountRequest_RelativeExpiry)(nil),
}
file_trader_proto_msgTypes[12].OneofWrappers = []any{
file_trader_proto_msgTypes[12].OneofWrappers = []interface{}{
(*DepositAccountRequest_AbsoluteExpiry)(nil),
(*DepositAccountRequest_RelativeExpiry)(nil),
}
file_trader_proto_msgTypes[14].OneofWrappers = []any{
file_trader_proto_msgTypes[14].OneofWrappers = []interface{}{
(*RenewAccountRequest_AbsoluteExpiry)(nil),
(*RenewAccountRequest_RelativeExpiry)(nil),
}
file_trader_proto_msgTypes[19].OneofWrappers = []any{
file_trader_proto_msgTypes[19].OneofWrappers = []interface{}{
(*SubmitOrderRequest_Ask)(nil),
(*SubmitOrderRequest_Bid)(nil),
}
file_trader_proto_msgTypes[20].OneofWrappers = []any{
file_trader_proto_msgTypes[20].OneofWrappers = []interface{}{
(*SubmitOrderResponse_InvalidOrder)(nil),
(*SubmitOrderResponse_AcceptedOrderNonce)(nil),
}
file_trader_proto_msgTypes[30].OneofWrappers = []any{
file_trader_proto_msgTypes[30].OneofWrappers = []interface{}{
(*OrderEvent_StateChange)(nil),
(*OrderEvent_Matched)(nil),
}
file_trader_proto_msgTypes[36].OneofWrappers = []any{
file_trader_proto_msgTypes[36].OneofWrappers = []interface{}{
(*AccountModificationFee_FeeNull)(nil),
(*AccountModificationFee_FeeValue)(nil),
}

View file

@ -54,7 +54,11 @@ func request_Trader_StopDaemon_0(ctx context.Context, marshaler runtime.Marshale
var protoReq StopDaemonRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -67,7 +71,11 @@ func local_request_Trader_StopDaemon_0(ctx context.Context, marshaler runtime.Ma
var protoReq StopDaemonRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -80,7 +88,11 @@ func request_Trader_QuoteAccount_0(ctx context.Context, marshaler runtime.Marsha
var protoReq QuoteAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -93,7 +105,11 @@ func local_request_Trader_QuoteAccount_0(ctx context.Context, marshaler runtime.
var protoReq QuoteAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -106,7 +122,11 @@ func request_Trader_InitAccount_0(ctx context.Context, marshaler runtime.Marshal
var protoReq InitAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -119,7 +139,11 @@ func local_request_Trader_InitAccount_0(ctx context.Context, marshaler runtime.M
var protoReq InitAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -204,7 +228,11 @@ func request_Trader_WithdrawAccount_0(ctx context.Context, marshaler runtime.Mar
var protoReq WithdrawAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -217,7 +245,11 @@ func local_request_Trader_WithdrawAccount_0(ctx context.Context, marshaler runti
var protoReq WithdrawAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -230,7 +262,11 @@ func request_Trader_DepositAccount_0(ctx context.Context, marshaler runtime.Mars
var protoReq DepositAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -243,7 +279,11 @@ func local_request_Trader_DepositAccount_0(ctx context.Context, marshaler runtim
var protoReq DepositAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -256,7 +296,11 @@ func request_Trader_RenewAccount_0(ctx context.Context, marshaler runtime.Marsha
var protoReq RenewAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -269,7 +313,11 @@ func local_request_Trader_RenewAccount_0(ctx context.Context, marshaler runtime.
var protoReq RenewAccountRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -282,7 +330,11 @@ func request_Trader_BumpAccountFee_0(ctx context.Context, marshaler runtime.Mars
var protoReq BumpAccountFeeRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -295,7 +347,11 @@ func local_request_Trader_BumpAccountFee_0(ctx context.Context, marshaler runtim
var protoReq BumpAccountFeeRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -308,7 +364,11 @@ func request_Trader_RecoverAccounts_0(ctx context.Context, marshaler runtime.Mar
var protoReq RecoverAccountsRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -321,7 +381,11 @@ func local_request_Trader_RecoverAccounts_0(ctx context.Context, marshaler runti
var protoReq RecoverAccountsRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -334,7 +398,11 @@ func request_Trader_SubmitOrder_0(ctx context.Context, marshaler runtime.Marshal
var protoReq SubmitOrderRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -347,7 +415,11 @@ func local_request_Trader_SubmitOrder_0(ctx context.Context, marshaler runtime.M
var protoReq SubmitOrderRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -448,7 +520,11 @@ func request_Trader_QuoteOrder_0(ctx context.Context, marshaler runtime.Marshale
var protoReq QuoteOrderRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -461,7 +537,11 @@ func local_request_Trader_QuoteOrder_0(ctx context.Context, marshaler runtime.Ma
var protoReq QuoteOrderRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -832,7 +912,11 @@ func request_Trader_OfferSidecar_0(ctx context.Context, marshaler runtime.Marsha
var protoReq OfferSidecarRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -845,7 +929,11 @@ func local_request_Trader_OfferSidecar_0(ctx context.Context, marshaler runtime.
var protoReq OfferSidecarRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -858,7 +946,11 @@ func request_Trader_RegisterSidecar_0(ctx context.Context, marshaler runtime.Mar
var protoReq RegisterSidecarRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -871,7 +963,11 @@ func local_request_Trader_RegisterSidecar_0(ctx context.Context, marshaler runti
var protoReq RegisterSidecarRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -884,7 +980,11 @@ func request_Trader_ExpectSidecarChannel_0(ctx context.Context, marshaler runtim
var protoReq ExpectSidecarChannelRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -897,7 +997,11 @@ func local_request_Trader_ExpectSidecarChannel_0(ctx context.Context, marshaler
var protoReq ExpectSidecarChannelRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -910,7 +1014,6 @@ func local_request_Trader_ExpectSidecarChannel_0(ctx context.Context, marshaler
// UnaryRPC :call TraderServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTraderHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterTraderHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TraderServer) error {
mux.Handle("GET", pattern_Trader_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
@ -1619,21 +1722,21 @@ func RegisterTraderHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
// RegisterTraderHandlerFromEndpoint is same as RegisterTraderHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTraderHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
@ -1651,7 +1754,7 @@ func RegisterTraderHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TraderClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TraderClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "TraderClient" to call the correct interceptors. This client ignores the HTTP middlewares.
// "TraderClient" to call the correct interceptors.
func RegisterTraderHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TraderClient) error {
mux.Handle("GET", pattern_Trader_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {

View file

@ -1188,7 +1188,6 @@
"matched_orders": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcMatchedOrderSnapshot"
},
"description": "Deprecated, use matched_markets."
@ -1227,7 +1226,6 @@
"batches": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcBatchSnapshotResponse"
},
"description": "The list of batches requested."
@ -1762,7 +1760,6 @@
"leases": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcLease"
},
"description": "The relevant list of leases purchased or sold within the auction."
@ -1785,7 +1782,6 @@
"accounts": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcAccount"
}
}
@ -1797,7 +1793,6 @@
"modification_fees": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcAccountModificationFee"
}
}
@ -1809,14 +1804,12 @@
"asks": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcAsk"
}
},
"bids": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcBid"
}
}
@ -1828,7 +1821,6 @@
"tickets": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcDecodedSidecarTicket"
}
}
@ -1883,7 +1875,6 @@
"num_asks": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/MarketInfoTierValue"
},
"description": "The number of open/pending ask orders per node tier."
@ -1891,7 +1882,6 @@
"num_bids": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/MarketInfoTierValue"
},
"description": "The number of open/pending bid orders per node tier."
@ -1899,7 +1889,6 @@
"ask_open_interest_units": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/MarketInfoTierValue"
},
"description": "The total number of open/unmatched units in open/pending ask orders per node\ntier."
@ -1907,7 +1896,6 @@
"bid_open_interest_units": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/MarketInfoTierValue"
},
"description": "The total number of open/unmatched units in open/pending bid orders per node\ntier."
@ -1968,7 +1956,6 @@
"matched_orders": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcMatchedOrderSnapshot"
},
"description": "The set of all orders matched in the batch."
@ -2053,7 +2040,6 @@
"node_ratings": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcNodeRating"
},
"description": "A series of node ratings for each of the queried nodes."
@ -2138,7 +2124,6 @@
"events": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcOrderEvent"
},
"description": "A list of events that were emitted for this order. This field is only set\nwhen the verbose flag is set to true in the request."
@ -2278,7 +2263,6 @@
"outputs": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcOutput"
}
}
@ -2538,7 +2522,6 @@
"tokens": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcLsatToken"
},
"description": "*\nList of all tokens the daemon knows of, including old/expired tokens."
@ -2574,7 +2557,6 @@
"outputs": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/poolrpcOutput"
},
"description": "The outputs we'll withdraw funds from the account into."
@ -2636,7 +2618,6 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}

View file

@ -1,7 +1,7 @@
package poolscript
import (
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)

View file

@ -9,12 +9,10 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/schnorr"
"github.com/btcsuite/btcd/btcec/v2/schnorr/musig2"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
secp "github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/lightninglabs/lndclient"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnrpc"
@ -848,7 +846,6 @@ func FundingOutput(commitmentType lnrpc.CommitmentType, ourKey,
"remote key %x", ourKey, theirKey)
_, fundingOutput, err := input.GenTaprootFundingScript(
ourPubKey, theirPubKey, chanSize,
fn.None[chainhash.Hash](),
)
if err != nil {
return nil, err

View file

@ -307,13 +307,10 @@ func (s *rpcServer) serverHandler(blockChan chan int32,
}
case err := <-s.auctioneer.StreamErrChan:
// Any error received on the stream means the
// long-lived subscription is gone and needs to be
// re-established. The only other "shutdown" signal
// the client raises (an explicit SERVER_SHUTDOWN
// message from the auctioneer) is handled inline in
// the read loop and never reaches this channel.
if err != nil {
// If the server is shutting down, then the client has
// already scheduled a restart. We only need to handle
// other errors here.
if err != nil && err != auctioneer.ErrServerShutdown {
rpcLog.Errorf("Error in server stream: %v", err)
err := s.auctioneer.HandleServerShutdown(err)
if err != nil {
@ -322,6 +319,8 @@ func (s *rpcServer) serverHandler(blockChan chan int32,
}
}
rpcLog.Errorf("Unknown server error: %v", err)
case height := <-blockChan:
rpcLog.Infof("Received new block notification: "+
"height=%v", height)

View file

@ -8,6 +8,7 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/wire"
gomock "github.com/golang/mock/gomock"
"github.com/lightninglabs/lndclient"
"github.com/lightninglabs/pool/account"
"github.com/lightninglabs/pool/order"
@ -16,7 +17,6 @@ import (
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
var (
@ -103,7 +103,6 @@ var renewAccountTestCases = []struct {
},
mockSetter: func(req *poolrpc.RenewAccountRequest,
accMgr *account.MockManager, marshalerMock *MockMarshaler) {
// Renew account params
bestHeight := uint32(100)
feeRate := chainfee.SatPerKWeight(req.FeeRateSatPerKw)
@ -111,7 +110,7 @@ var renewAccountTestCases = []struct {
if expiryHeight == 0 {
expiryHeight = 100 + req.GetRelativeExpiry()
}
version := account.VersionMuSig2V100RC2
version := account.VersionTaprootEnabled
acc := &account.Account{}
tx := &wire.MsgTx{}
accMgr.EXPECT().
@ -176,6 +175,8 @@ var renewAccountTestCases = []struct {
func TestRenewAccount(t *testing.T) {
for _, tc := range renewAccountTestCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

36
run.go
View file

@ -20,47 +20,25 @@ func Run(cfg *Config) error {
}
cfg.RequestShutdown = cfg.ShutdownInterceptor.RequestShutdown
sugLogMgr := build.NewSubLoggerManager(
build.NewDefaultLogHandlers(cfg.Logging, logWriter)...,
)
SetupLoggers(sugLogMgr, cfg.ShutdownInterceptor)
logWriter = build.NewRotatingLogWriter()
SetupLoggers(logWriter, cfg.ShutdownInterceptor)
// Special show command to list supported subsystems and exit.
if cfg.DebugLevel == "show" {
fmt.Printf("Supported subsystems: %v\n",
sugLogMgr.SupportedSubsystems())
logWriter.SupportedSubsystems())
os.Exit(0)
}
if cfg.MaxLogFiles != 0 {
if cfg.Logging.File.MaxLogFiles !=
build.DefaultMaxLogFiles {
return fmt.Errorf("cannot set both maxlogfiles and "+
"logging.file.max-files: %w", err)
}
cfg.Logging.File.MaxLogFiles = cfg.MaxLogFiles
}
if cfg.MaxLogFileSize != 0 {
if cfg.Logging.File.MaxLogFileSize !=
build.DefaultMaxLogFileSize {
return fmt.Errorf("cannot set both maxlogfilesize and "+
"logging.file.max-file-size: %w", err)
}
cfg.Logging.File.MaxLogFileSize = cfg.MaxLogFileSize
}
// Initialize logging at the default logging level.
err = logWriter.InitLogRotator(
cfg.Logging.File, filepath.Join(cfg.LogDir, DefaultLogFilename),
filepath.Join(cfg.LogDir, DefaultLogFilename),
cfg.MaxLogFileSize, cfg.MaxLogFiles,
)
if err != nil {
return err
}
err = build.ParseAndSetDebugLevels(cfg.DebugLevel, sugLogMgr)
err = build.ParseAndSetDebugLevels(cfg.DebugLevel, logWriter)
if err != nil {
return err
}

View file

@ -24,6 +24,7 @@ import (
"github.com/lightninglabs/pool/clientdb"
"github.com/lightninglabs/pool/funding"
"github.com/lightninglabs/pool/order"
"github.com/lightninglabs/pool/perms"
"github.com/lightninglabs/pool/poolrpc"
"github.com/lightninglabs/pool/terms"
"github.com/lightningnetwork/lnd/kvdb"
@ -45,8 +46,8 @@ var (
// required in lnd to run pool.
minimalCompatibleVersion = &verrpc.Version{
AppMajor: 0,
AppMinor: 18,
AppPatch: 5,
AppMinor: 15,
AppPatch: 4,
// We don't actually require the invoicesrpc calls. But if we
// try to use lndclient on an lnd that doesn't have it enabled,
@ -198,7 +199,7 @@ func (s *Server) Start() error {
Checkers: []macaroons.Checker{
macaroons.IPLockChecker,
},
RequiredPerms: poolrpc.RequiredPermissions,
RequiredPerms: perms.RequiredPermissions,
DBPassword: macDbDefaultPw,
LndClient: &s.lndServices.LndServices,
EphemeralKey: lndclient.SharedKeyNUMS,
@ -424,7 +425,7 @@ func (s *Server) StartAsSubserver(lndClient lnrpc.LightningClient,
Checkers: []macaroons.Checker{
macaroons.IPLockChecker,
},
RequiredPerms: poolrpc.RequiredPermissions,
RequiredPerms: perms.RequiredPermissions,
DBPassword: macDbDefaultPw,
LndClient: &s.lndServices.LndServices,
EphemeralKey: lndclient.SharedKeyNUMS,
@ -563,7 +564,7 @@ func (s *Server) setupClient() error {
return &tokenID, nil
}
}
activeLoggers := subLogMgr.SubLoggers()
activeLoggers := logWriter.SubLoggers()
s.cfg.AuctioneerDialOpts = append(
s.cfg.AuctioneerDialOpts,
grpc.WithChainUnaryInterceptor(

View file

@ -36,7 +36,7 @@ func EncodeToString(t *Ticket) (string, error) {
// First, we'll write the sidecar prefix, as well as the serialized
// ticket into the buffer that we'll use to generate the checksum. We
// do this as we won't encode the checksum using base58.
if _, err := checksumBuf.WriteString(sidecarPrefix); err != nil {
if _, err := checksumBuf.Write([]byte(sidecarPrefix)); err != nil {
return "", err
}
if _, err := checksumBuf.Write(encodingVersion); err != nil {

View file

@ -1,10 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: sidecar/interfaces.go
//
// Generated by this command:
//
// mockgen -source=sidecar/interfaces.go -package=sidecar -destination=sidecar/mock_interfaces.go
//
// Package sidecar is a generated GoMock package.
package sidecar
@ -12,8 +7,8 @@ package sidecar
import (
reflect "reflect"
btcec "github.com/btcsuite/btcd/btcec/v2"
gomock "go.uber.org/mock/gomock"
v2 "github.com/btcsuite/btcd/btcec/v2"
gomock "github.com/golang/mock/gomock"
)
// MockStore is a mock of Store interface.
@ -48,13 +43,13 @@ func (m *MockStore) AddSidecar(sidecar *Ticket) error {
}
// AddSidecar indicates an expected call of AddSidecar.
func (mr *MockStoreMockRecorder) AddSidecar(sidecar any) *gomock.Call {
func (mr *MockStoreMockRecorder) AddSidecar(sidecar interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSidecar", reflect.TypeOf((*MockStore)(nil).AddSidecar), sidecar)
}
// Sidecar mocks base method.
func (m *MockStore) Sidecar(id [8]byte, offerSignPubKey *btcec.PublicKey) (*Ticket, error) {
func (m *MockStore) Sidecar(id [8]byte, offerSignPubKey *v2.PublicKey) (*Ticket, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Sidecar", id, offerSignPubKey)
ret0, _ := ret[0].(*Ticket)
@ -63,7 +58,7 @@ func (m *MockStore) Sidecar(id [8]byte, offerSignPubKey *btcec.PublicKey) (*Tick
}
// Sidecar indicates an expected call of Sidecar.
func (mr *MockStoreMockRecorder) Sidecar(id, offerSignPubKey any) *gomock.Call {
func (mr *MockStoreMockRecorder) Sidecar(id, offerSignPubKey interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sidecar", reflect.TypeOf((*MockStore)(nil).Sidecar), id, offerSignPubKey)
}
@ -92,7 +87,7 @@ func (m *MockStore) UpdateSidecar(sidecar *Ticket) error {
}
// UpdateSidecar indicates an expected call of UpdateSidecar.
func (mr *MockStoreMockRecorder) UpdateSidecar(sidecar any) *gomock.Call {
func (mr *MockStoreMockRecorder) UpdateSidecar(sidecar interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSidecar", reflect.TypeOf((*MockStore)(nil).UpdateSidecar), sidecar)
}

View file

@ -8,6 +8,7 @@ import (
"time"
"github.com/btcsuite/btcd/btcec/v2"
gomock "github.com/golang/mock/gomock"
"github.com/lightninglabs/pool/account"
"github.com/lightninglabs/pool/auctioneer"
"github.com/lightninglabs/pool/clientdb"
@ -18,7 +19,6 @@ import (
"github.com/lightningnetwork/lnd/lntest/wait"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
var (

View file

@ -1,4 +1,4 @@
FROM golang:1.23.6-bookworm
FROM golang:1.19.4
RUN apt-get update && apt-get install -y git
ENV GOCACHE=/tmp/build/.cache

View file

@ -1,201 +1,188 @@
module github.com/lightninglabs/pool/tools
go 1.18
require (
github.com/golangci/golangci-lint v1.64.5
github.com/golangci/golangci-lint v1.51.2
github.com/ory/go-acc v0.2.6
github.com/rinchsan/gosimports v0.1.5
)
require (
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
4d63.com/gochecknoglobals v0.2.2 // indirect
github.com/4meepo/tagalign v1.4.1 // indirect
github.com/Abirdcfly/dupword v0.1.3 // indirect
github.com/Antonboom/errname v1.0.0 // indirect
github.com/Antonboom/nilnil v1.0.1 // indirect
github.com/Antonboom/testifylint v1.5.2 // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/Crocmagnon/fatcontext v0.7.1 // indirect
4d63.com/gochecknoglobals v0.2.1 // indirect
github.com/Abirdcfly/dupword v0.0.9 // indirect
github.com/Antonboom/errname v0.1.7 // indirect
github.com/Antonboom/nilnil v0.1.1 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
github.com/alexkohler/nakedret/v2 v2.0.5 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/OpenPeeDeeP/depguard v1.1.1 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
github.com/alingse/asasalint v0.0.11 // indirect
github.com/alingse/nilnesserr v0.1.2 // indirect
github.com/ashanbrown/forbidigo v1.6.0 // indirect
github.com/ashanbrown/makezero v1.2.0 // indirect
github.com/ashanbrown/forbidigo v1.4.0 // indirect
github.com/ashanbrown/makezero v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bkielbasa/cyclop v1.2.3 // indirect
github.com/bkielbasa/cyclop v1.2.0 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v4 v4.5.0 // indirect
github.com/breml/bidichk v0.3.2 // indirect
github.com/breml/errchkjson v0.4.0 // indirect
github.com/butuzov/ireturn v0.3.1 // indirect
github.com/butuzov/mirror v1.3.0 // indirect
github.com/catenacyber/perfsprint v0.8.1 // indirect
github.com/ccojocar/zxcvbn-go v1.0.2 // indirect
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
github.com/breml/bidichk v0.2.3 // indirect
github.com/breml/errchkjson v0.3.0 // indirect
github.com/butuzov/ireturn v0.1.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/ckaznocha/intrange v0.3.0 // indirect
github.com/curioswitch/go-reassign v0.3.0 // indirect
github.com/daixiang0/gci v0.13.5 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/charithe/durationcheck v0.0.9 // indirect
github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/denis-tingaikin/go-header v0.4.3 // indirect
github.com/dgraph-io/ristretto v0.0.2 // indirect
github.com/ettle/strcase v0.2.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/esimonov/ifshort v1.0.4 // indirect
github.com/ettle/strcase v0.1.1 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/firefart/nonamedreturns v1.0.5 // indirect
github.com/firefart/nonamedreturns v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/ghostiam/protogetter v0.3.9 // indirect
github.com/go-critic/go-critic v0.12.0 // indirect
github.com/go-critic/go-critic v0.6.7 // indirect
github.com/go-toolsmith/astcast v1.1.0 // indirect
github.com/go-toolsmith/astcopy v1.1.0 // indirect
github.com/go-toolsmith/astequal v1.2.0 // indirect
github.com/go-toolsmith/astcopy v1.0.3 // indirect
github.com/go-toolsmith/astequal v1.1.0 // indirect
github.com/go-toolsmith/astfmt v1.1.0 // indirect
github.com/go-toolsmith/astp v1.1.0 // indirect
github.com/go-toolsmith/strparse v1.1.0 // indirect
github.com/go-toolsmith/typep v1.1.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
github.com/golangci/go-printf-func-name v0.1.0 // indirect
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
github.com/golangci/misspell v0.6.0 // indirect
github.com/golangci/plugin-module-register v0.1.1 // indirect
github.com/golangci/revgrep v0.8.0 // indirect
github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gordonklaus/ineffassign v0.1.0 // indirect
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect
github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
github.com/golangci/misspell v0.4.0 // indirect
github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/gostaticanalysis/comment v1.4.2 // indirect
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jgautheron/goconst v1.7.1 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jgautheron/goconst v1.5.1 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jjti/go-spancheck v0.6.4 // indirect
github.com/julz/importas v0.2.0 // indirect
github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect
github.com/kisielk/errcheck v1.8.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.5 // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/julz/importas v0.1.0 // indirect
github.com/junk1tm/musttag v0.4.5 // indirect
github.com/kisielk/errcheck v1.6.3 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.3 // indirect
github.com/kulti/thelper v0.6.3 // indirect
github.com/kunwardeep/paralleltest v1.0.10 // indirect
github.com/lasiar/canonicalheader v1.1.2 // indirect
github.com/ldez/exptostd v0.4.1 // indirect
github.com/ldez/gomoddirectives v0.6.1 // indirect
github.com/ldez/grignotin v0.9.0 // indirect
github.com/ldez/tagliatelle v0.7.1 // indirect
github.com/ldez/usetesting v0.4.2 // indirect
github.com/leonklingele/grouper v1.1.2 // indirect
github.com/macabu/inamedparam v0.1.3 // indirect
github.com/kunwardeep/paralleltest v1.0.6 // indirect
github.com/kyoh86/exportloopref v0.1.11 // indirect
github.com/ldez/gomoddirectives v0.2.3 // indirect
github.com/ldez/tagliatelle v0.4.0 // indirect
github.com/leonklingele/grouper v1.1.1 // indirect
github.com/lufeee/execinquery v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/maratori/testableexamples v1.0.0 // indirect
github.com/maratori/testpackage v1.1.1 // indirect
github.com/matoous/godox v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/maratori/testpackage v1.1.0 // indirect
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mgechev/revive v1.6.1 // indirect
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
github.com/mgechev/revive v1.2.5 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
github.com/moricho/tparallel v0.2.1 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.12.0 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
github.com/nishanths/exhaustive v0.9.5 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.19.0 // indirect
github.com/nunnatsa/ginkgolinter v0.8.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/ory/viper v1.7.5 // indirect
github.com/pborman/uuid v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polyfloyd/go-errorlint v1.7.1 // indirect
github.com/polyfloyd/go-errorlint v1.1.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 // indirect
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
github.com/quasilyte/go-ruleguard v0.3.19 // indirect
github.com/quasilyte/gogrep v0.5.0 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/raeperd/recvcheck v0.2.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/ryancurrah/gomodguard v1.3.5 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
github.com/ryancurrah/gomodguard v1.3.0 // indirect
github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect
github.com/securego/gosec/v2 v2.22.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sivchari/tenv v1.12.1 // indirect
github.com/sonatard/noctx v0.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect
github.com/securego/gosec/v2 v2.15.0 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/sivchari/containedctx v1.0.2 // indirect
github.com/sivchari/nosnakecase v1.7.0 // indirect
github.com/sivchari/tenv v1.7.1 // indirect
github.com/sonatard/noctx v0.0.1 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.2.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/tdakkota/asciicheck v0.4.0 // indirect
github.com/tetafro/godot v1.4.20 // indirect
github.com/timakin/bodyclose v0.0.0-20241017074812-ed6a65f985e3 // indirect
github.com/timonwong/loggercheck v0.10.1 // indirect
github.com/tomarrell/wrapcheck/v2 v2.10.0 // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.1.1 // indirect
github.com/tetafro/godot v1.4.11 // indirect
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect
github.com/timonwong/loggercheck v0.9.3 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.0 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ultraware/funlen v0.2.0 // indirect
github.com/ultraware/whitespace v0.2.0 // indirect
github.com/uudashr/gocognit v1.2.0 // indirect
github.com/uudashr/iface v1.3.1 // indirect
github.com/xen0n/gosmopolitan v1.2.2 // indirect
github.com/ultraware/funlen v0.0.3 // indirect
github.com/ultraware/whitespace v0.0.5 // indirect
github.com/uudashr/gocognit v1.0.6 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.3.0 // indirect
github.com/ykadowak/zerologlint v0.1.5 // indirect
gitlab.com/bosi/decorder v0.4.2 // indirect
go-simpler.org/musttag v0.13.0 // indirect
go-simpler.org/sloglint v0.9.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
gitlab.com/bosi/decorder v0.2.3 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/protobuf v1.36.4 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.6.0 // indirect
mvdan.cc/gofumpt v0.7.0 // indirect
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect
honnef.co/go/tools v0.4.2 // indirect
mvdan.cc/gofumpt v0.4.0 // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect
)
go 1.23.6

File diff suppressed because it is too large Load diff

View file

@ -28,8 +28,8 @@ const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr
// versioning 2.0.0 spec (http://semver.org/).
const (
appMajor uint = 0
appMinor uint = 7
appPatch uint = 1
appMinor uint = 6
appPatch uint = 5
// appPreRelease MUST only contain characters from semanticAlphabet per
// the semantic versioning spec.