diff --git a/config.md b/config.md index fd9cffb..569c3da 100644 --- a/config.md +++ b/config.md @@ -124,7 +124,7 @@ |count|The maximum number of times to retry|`int`|`5` |enabled|Enables retries|`boolean`|`false` |errorStatusCodeRegex|The regex that the error response status code must match to trigger retry|`string`|`` -|factor|(Deprecated) Please refer to `connector.queryLoopRetry.factor` to understand its original purpose and use that instead|`float32`|`` +|factor|(Deprecated) Please refer to `connector.queryLoopRetry.factor` to understand its original purpose and use that instead|`float32`|`2` |initWaitTime|The initial retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`250ms` |initialDelay|(Deprecated) Please refer to `connector.queryLoopRetry.initialDelay` to understand its original purpose and use that instead|[`time.Duration`](https://pkg.go.dev/time#Duration)|`` |maxDelay|(Deprecated) Please refer to `connector.queryLoopRetry.maxDelay` to understand its original purpose and use that instead|[`time.Duration`](https://pkg.go.dev/time#Duration)|`` @@ -156,6 +156,7 @@ |Key|Description|Type|Default Value| |---|-----------|----|-------------| +|backgroundConnect|When true the connection is established in the background with infinite reconnect (makes initialConnectAttempts redundant when set)|`boolean`|`false` |connectionTimeout|The amount of time to wait while establishing a connection (or auto-reconnection)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`45s` |enabled|When true a WebSocket is established for block listening, in addition to the HTTP RPC connections used for other functions|`boolean`|`false` |heartbeatInterval|The amount of time to wait between heartbeat signals on the WebSocket connection|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` diff --git a/go.mod b/go.mod index 6c004cf..3463287 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.23.0 require ( github.com/hashicorp/golang-lru v1.0.2 - github.com/hyperledger/firefly-common v1.5.1 + github.com/hyperledger/firefly-common v1.5.5 github.com/hyperledger/firefly-signer v1.1.21 - github.com/hyperledger/firefly-transaction-manager v1.3.20 + github.com/hyperledger/firefly-transaction-manager v1.4.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 4f2ef8c..7fec939 100644 --- a/go.sum +++ b/go.sum @@ -100,12 +100,12 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/hyperledger/firefly-common v1.5.1 h1:/DREi1ye1HfYr3GDLBhXuugeMzT4zg9EN2uTYFlVY6M= -github.com/hyperledger/firefly-common v1.5.1/go.mod h1:1Xawm5PUhxT7k+CL/Kr3i1LE3cTTzoQwZMLimvlW8rs= +github.com/hyperledger/firefly-common v1.5.5 h1:UaANgBIT0aBvAk0Yt+Qrn6qXxpwNIrFfwnW3EBivrQs= +github.com/hyperledger/firefly-common v1.5.5/go.mod h1:1Xawm5PUhxT7k+CL/Kr3i1LE3cTTzoQwZMLimvlW8rs= github.com/hyperledger/firefly-signer v1.1.21 h1:r7cTOw6e/6AtiXLf84wZy6Z7zppzlc191HokW2hv4N4= github.com/hyperledger/firefly-signer v1.1.21/go.mod h1:axrlSQeKrd124UdHF5L3MkTjb5DeTcbJxJNCZ3JmcWM= -github.com/hyperledger/firefly-transaction-manager v1.3.20 h1:Rs9ZW4XyOk3+mH5XBmcP9yFAeKMBtcJyOPCq4N/MnXY= -github.com/hyperledger/firefly-transaction-manager v1.3.20/go.mod h1:cWiZ5YpvHJryoRoe7loNRn4ciPMq/XvrP5Lw2lopjKg= +github.com/hyperledger/firefly-transaction-manager v1.4.0 h1:l9DCizLTohKtKec5dewNlydhAeko1/DmTfCRF8le9m0= +github.com/hyperledger/firefly-transaction-manager v1.4.0/go.mod h1:mEd9dOH8ds6ajgfPh6nnP3Pd3f8XIZtQRnucqAIJHRs= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= diff --git a/mocks/fftmmocks/manager.go b/mocks/fftmmocks/manager.go index 725cae5..6134d08 100644 --- a/mocks/fftmmocks/manager.go +++ b/mocks/fftmmocks/manager.go @@ -1,19 +1,136 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery v2.52.2. DO NOT EDIT. package fftmmocks -import mock "github.com/stretchr/testify/mock" +import ( + context "context" + + apitypes "github.com/hyperledger/firefly-transaction-manager/pkg/apitypes" + + eventapi "github.com/hyperledger/firefly-transaction-manager/pkg/eventapi" + + mock "github.com/stretchr/testify/mock" + + mux "github.com/gorilla/mux" + + txhandler "github.com/hyperledger/firefly-transaction-manager/pkg/txhandler" +) // Manager is an autogenerated mock type for the Manager type type Manager struct { mock.Mock } +// APIRouter provides a mock function with no fields +func (_m *Manager) APIRouter() *mux.Router { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for APIRouter") + } + + var r0 *mux.Router + if rf, ok := ret.Get(0).(func() *mux.Router); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*mux.Router) + } + } + + return r0 +} + +// CleanupAPIManagedEventStream provides a mock function with given fields: name +func (_m *Manager) CleanupAPIManagedEventStream(name string) error { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for CleanupAPIManagedEventStream") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // Close provides a mock function with no fields func (_m *Manager) Close() { _m.Called() } +// GetAPIManagedEventStream provides a mock function with given fields: spec, listeners +func (_m *Manager) GetAPIManagedEventStream(spec *apitypes.EventStream, listeners []*apitypes.Listener) (bool, eventapi.EventStream, error) { + ret := _m.Called(spec, listeners) + + if len(ret) == 0 { + panic("no return value specified for GetAPIManagedEventStream") + } + + var r0 bool + var r1 eventapi.EventStream + var r2 error + if rf, ok := ret.Get(0).(func(*apitypes.EventStream, []*apitypes.Listener) (bool, eventapi.EventStream, error)); ok { + return rf(spec, listeners) + } + if rf, ok := ret.Get(0).(func(*apitypes.EventStream, []*apitypes.Listener) bool); ok { + r0 = rf(spec, listeners) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(*apitypes.EventStream, []*apitypes.Listener) eventapi.EventStream); ok { + r1 = rf(spec, listeners) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(eventapi.EventStream) + } + } + + if rf, ok := ret.Get(2).(func(*apitypes.EventStream, []*apitypes.Listener) error); ok { + r2 = rf(spec, listeners) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// GetTransactionByIDWithStatus provides a mock function with given fields: ctx, txID, withHistory +func (_m *Manager) GetTransactionByIDWithStatus(ctx context.Context, txID string, withHistory bool) (*apitypes.TXWithStatus, error) { + ret := _m.Called(ctx, txID, withHistory) + + if len(ret) == 0 { + panic("no return value specified for GetTransactionByIDWithStatus") + } + + var r0 *apitypes.TXWithStatus + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, bool) (*apitypes.TXWithStatus, error)); ok { + return rf(ctx, txID, withHistory) + } + if rf, ok := ret.Get(0).(func(context.Context, string, bool) *apitypes.TXWithStatus); ok { + r0 = rf(ctx, txID, withHistory) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*apitypes.TXWithStatus) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, txID, withHistory) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Start provides a mock function with no fields func (_m *Manager) Start() error { ret := _m.Called() @@ -32,6 +149,46 @@ func (_m *Manager) Start() error { return r0 } +// TransactionCompletions provides a mock function with no fields +func (_m *Manager) TransactionCompletions() txhandler.TransactionCompletions { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for TransactionCompletions") + } + + var r0 txhandler.TransactionCompletions + if rf, ok := ret.Get(0).(func() txhandler.TransactionCompletions); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(txhandler.TransactionCompletions) + } + } + + return r0 +} + +// TransactionHandler provides a mock function with no fields +func (_m *Manager) TransactionHandler() txhandler.TransactionHandler { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for TransactionHandler") + } + + var r0 txhandler.TransactionHandler + if rf, ok := ret.Get(0).(func() txhandler.TransactionHandler); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(txhandler.TransactionHandler) + } + } + + return r0 +} + // NewManager creates a new instance of Manager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewManager(t interface { diff --git a/mocks/rpcbackendmocks/backend.go b/mocks/rpcbackendmocks/backend.go index 974807e..3af6838 100644 --- a/mocks/rpcbackendmocks/backend.go +++ b/mocks/rpcbackendmocks/backend.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery v2.52.2. DO NOT EDIT. package rpcbackendmocks