Skip to content

Commit

Permalink
Hotfix sourcing wallet root path
Browse files Browse the repository at this point in the history
  • Loading branch information
altafan committed Jul 13, 2023
1 parent 517c3f9 commit b33dd3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/app-config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (c *AppConfig) transactionService() *application.TransactionService {
rm, _ := c.repoManager()
bcs, _ := c.bcScanner()
c.txSvc = application.NewTransactionService(
rm, bcs, c.Network, c.RootPath, c.UtxoExpiryDuration,
rm, bcs, c.Network, c.UtxoExpiryDuration,
)
return c.txSvc
}
Expand Down
7 changes: 3 additions & 4 deletions internal/core/application/transaction_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,21 @@ type TransactionService struct {
repoManager ports.RepoManager
bcScanner ports.BlockchainScanner
network *network.Network
rootPath string
utxoExpiryDuration time.Duration

log func(format string, a ...interface{})
}

func NewTransactionService(
repoManager ports.RepoManager, bcScanner ports.BlockchainScanner,
net *network.Network, rootPath string, utxoExpiryDuration time.Duration,
net *network.Network, utxoExpiryDuration time.Duration,
) *TransactionService {
logFn := func(format string, a ...interface{}) {
format = fmt.Sprintf("transaction service: %s", format)
log.Debugf(format, a...)
}
svc := &TransactionService{
repoManager, bcScanner, net, rootPath, utxoExpiryDuration, logFn,
repoManager, bcScanner, net, utxoExpiryDuration, logFn,
}
svc.registerHandlerForUtxoEvents()
svc.registerHandlerForWalletEvents()
Expand Down Expand Up @@ -746,7 +745,7 @@ func (ts *TransactionService) getWallet(
}

return singlesig.NewWalletFromMnemonic(singlesig.NewWalletFromMnemonicArgs{
RootPath: ts.rootPath,
RootPath: w.RootPath,
Mnemonic: mnemonic,
})
}
Expand Down
4 changes: 2 additions & 2 deletions internal/core/application/transaction_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func testExternalTransaction(t *testing.T) {
require.NotNil(t, repoManager)

svc := application.NewTransactionService(
repoManager, mockedBcScanner, regtest, rootPath, utxoExpiryDuration,
repoManager, mockedBcScanner, regtest, utxoExpiryDuration,
)

selectedUtxos, change, expirationDate, err := svc.SelectUtxos(
Expand Down Expand Up @@ -127,7 +127,7 @@ func testInternalTransaction(t *testing.T) {
require.NotNil(t, repoManager)

svc := application.NewTransactionService(
repoManager, mockedBcScanner, regtest, rootPath, utxoExpiryDuration,
repoManager, mockedBcScanner, regtest, utxoExpiryDuration,
)

txid, err := svc.Transfer(ctx, accountName, outputs, 0)
Expand Down

0 comments on commit b33dd3f

Please sign in to comment.