Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into staging-ln #3088

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a727fdd
frontend/exchange: fix wrong buy/sell tabs labels
Beerosagos Oct 1, 2024
f9ec869
Merge branch 'buy-sell-labels-fix' into release-v4.45.0
Beerosagos Oct 1, 2024
cd0e9f6
frontend: allow action buttons to grow on mobile
thisconnect Oct 1, 2024
cdb1b2c
frontend: make locize-pull
benma Oct 1, 2024
df7348d
backend: update to version 4.44.1
benma Oct 1, 2024
e43e676
Merge remote-tracking branch 'benma/v4.44.1-to-4.45' into release-v4.…
benma Oct 3, 2024
a6121ca
frontend: make locize-pull
benma Oct 9, 2024
e1178cb
Merge branch 'locize' into release-v4.45.0
benma Oct 9, 2024
5a1733c
frontend: fix spacing between receiver address and tx detail label
shonsirsha Oct 9, 2024
919489e
Merge branch 'frontend-fix-send-spacings' into release-v4.45.0
shonsirsha Oct 9, 2024
282386a
ci: More maintainable code
NickeZ Nov 3, 2024
d84218e
backend: remove "No priority" from fee options
strmci Nov 7, 2024
bd876f6
Merge branch 'remove_no_priority'
strmci Nov 7, 2024
de8da06
frontend: make locize-pull
benma Nov 5, 2024
2fdbbc5
Merge branch 'locize'
benma Nov 7, 2024
b3d5534
CHANGELOG: fix typo, reword
benma Nov 8, 2024
797e083
Merge branch 'typo'
benma Nov 8, 2024
074e758
Merge pull request #3016 from NickeZ/nickez/test-curl
NickeZ Nov 8, 2024
6a29a31
changelog: account page skeletons
shonsirsha Nov 5, 2024
133d705
Merge branch 'changelog-account-page-skeleton'
shonsirsha Nov 11, 2024
13a8e91
frontend: better font size & spacing during firwmware install
shonsirsha Nov 6, 2024
9fe8aff
Merge branch 'frontend-font-size-firmware-update'
shonsirsha Nov 11, 2024
09c636d
frontend: use darkmode colors for scrollbar
thisconnect Nov 11, 2024
5414f46
Merge branch 'frontend-improve-scrollbars'
thisconnect Nov 12, 2024
a6d7c5e
Merge remote-tracking branch 'upstream/release-v4.45.0' into release-…
thisconnect Nov 12, 2024
84a6607
Merge branch 'release-4.45-merged'
thisconnect Nov 12, 2024
f0b3bb2
frontend: update UI of add account dropdown to use react-select
shonsirsha Nov 11, 2024
f200fd0
Merge branch 'frontend-addaccount-dropdown-restyle'
shonsirsha Nov 12, 2024
bc386dc
frontend/qrcodescanner: improve qrscanner component
Beerosagos Oct 21, 2024
1d16700
backend: add litecoin to btcdirect supported coins
sutterseba Nov 12, 2024
91e4ed7
Merge branch 'qrscan-rotate-fix-rc' into release-v4.46.0
Beerosagos Nov 13, 2024
05396ae
frontend: fix minor spacing issue on medium size screens
thisconnect Nov 14, 2024
42a5ca3
frontend: make locize-pull
benma Nov 14, 2024
6392ff9
frontend/android: fix moonpay widget
Beerosagos Nov 14, 2024
f2d9df9
Merge branch 'frontend-fix-accountsummary-spacing' into release-v4.46.0
thisconnect Nov 14, 2024
3f90723
Merge branch 'locize' into release-v4.46.0
benma Nov 14, 2024
aa7d5d9
Merge branch 'moonpay-android-fix' into release-v4.46.0
Beerosagos Nov 14, 2024
5847353
Merge commit 'refs/pull/3046/head' of https://github.com/BitBoxSwiss/…
benma Nov 15, 2024
fbe9a75
frontend: improve simple markup parsing
thisconnect Nov 18, 2024
3e3a30c
frontend: make locize-pull
benma Nov 18, 2024
9d144ea
Merge branch 'locize' into release-v4.46.0
benma Nov 18, 2024
c4f40c4
android: bump versionCode
benma Nov 18, 2024
3e1929b
Merge branch 'buildversion' into release-v4.46.0
benma Nov 18, 2024
f3b21b0
Merge branch 'frontend-fix-i18n-markup-with-newlines'
thisconnect Nov 19, 2024
0dc7040
Merge remote-tracking branch 'upstream/release-v4.46.0' into resolve-…
thisconnect Nov 19, 2024
1a67def
backend: re-enable copyloopvar linter and refactor code
strmci Nov 15, 2024
12df2de
Merge branch 'enable_copyloopvar'
strmci Nov 20, 2024
95c0c41
envinit: use fixed versions of the mock tools
benma Nov 20, 2024
fe1117f
go: downgrade from Go 1.23 to 1.22 to fix an Android bug
benma Nov 20, 2024
758fcb9
backend: update to version 4.46.1
benma Nov 20, 2024
67352e1
Merge remote-tracking branch 'benma/go122' into release-v4.46.1
benma Nov 21, 2024
d78380f
qt: force mime type resolution by extension
benma Nov 21, 2024
6b2ddac
backend: update to version 4.46.2
benma Nov 22, 2024
ab325eb
Merge branch 'mimetype2' into release-v4.46.2
benma Nov 22, 2024
37ab166
Merge branch 'resolve-release-branch-conflict'
thisconnect Nov 25, 2024
aa3013c
qt: fix cam access by restoring window.isSecureContext
benma Nov 26, 2024
f3f3d12
backend: update to version 4.46.3
benma Nov 26, 2024
58498b2
Merge branch 'qt-securecontext' into release-v4.46.3
benma Nov 26, 2024
549efd6
frontend: show the full text of long transaction notes
thisconnect Nov 25, 2024
63f43e4
Merge remote-tracking branch 'pull/release-v4.46.1'
benma Nov 26, 2024
1b77204
Merge branch 'frontend-long-transaction-notes'
thisconnect Nov 26, 2024
b8a2c27
Merge remote-tracking branch 'pull/release-v4.46.2'
benma Nov 26, 2024
2b29341
frontend: change transaction info for send-to-self
thisconnect Nov 7, 2024
ebe632f
Merge branch 'frontend-improve-sendtoself'
thisconnect Nov 26, 2024
869b9ef
Merge remote-tracking branch 'pull/release-v4.46.3'
benma Nov 26, 2024
28e0cc4
frontend: fix labels are always gray
thisconnect Nov 26, 2024
55c2231
frontend: add css class to target platform
thisconnect Nov 11, 2024
4af6867
frontend: use custom scrollbars only on linux and windows
thisconnect Nov 11, 2024
990a8d5
frontend: fix white guide scrollbars on linux and windows
thisconnect Nov 25, 2024
7929ce8
Merge branch 'frontend-improve-scrollbars-macos'
thisconnect Nov 26, 2024
eaabaf3
frontend: update checkbox border color
thisconnect Nov 26, 2024
cdcc10d
frontend: update radio input color
thisconnect Nov 27, 2024
94a89ed
frontend: create reusable single & multi dropdown
shonsirsha Nov 26, 2024
865f21a
frontend: use newly created Dropdown component
shonsirsha Nov 27, 2024
3f64296
Merge branch 'frontend-refactor-dropdown'
shonsirsha Nov 28, 2024
d9b5ab3
Merge branch 'frontend-checkbox-labels'
thisconnect Nov 28, 2024
a13f06d
frontend: full width for Dropdowns in General settings on mobile
shonsirsha Nov 28, 2024
0c35d45
Merge branch 'frontend-full-width-select-mobile'
shonsirsha Nov 28, 2024
951e283
ci: build windows app and report artifact
sutterseba Nov 28, 2024
d0f1b36
frontend: fix mobile remember wallet settings layout
shonsirsha Nov 28, 2024
5afd06b
Merge branch 'frontend-mobile-remember-wallet-layout'
shonsirsha Dec 3, 2024
6f207ca
Merge branch 'ci-build-windows-app'
sutterseba Dec 3, 2024
7789b86
frontend: create dialog on remember wallet
shonsirsha Dec 2, 2024
44f3c76
Merge branch 'frontend-remember-wallet-enable-dialog'
shonsirsha Dec 3, 2024
f8e0f12
Merge remote-tracking branch 'upstream/master' into staging-ln-merge-…
thisconnect Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 60 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
# https://docs.github.com/en/packages/guides/pushing-and-pulling-docker-images
#
# Keep this in sync with default in scripts/github-ci.sh.
CI_IMAGE: ghcr.io/bitboxswiss/bitbox-wallet-app-ci:25
CI_IMAGE: ghcr.io/bitboxswiss/bitbox-wallet-app-ci:26
GITHUB_BUILD_DIR: ${{github.workspace}}

jobs:
Expand Down Expand Up @@ -181,9 +181,53 @@ jobs:
run: |
make gomobileinit
(cd $GOPATH/$GO_SRC_DIR; make ios)
windows:
runs-on: windows-2019
defaults:
run:
shell: bash
env:
MINGW_BIN: /C/mingw64/bin
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Go
uses: actions/setup-go@v5
with:
# Take Go version to install from go.mod
go-version-file: 'go.mod'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.2'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
modules: 'qtwebengine qtwebchannel qtpositioning'
- name: Link Visual Studio editions
# This is needed due to our build expecting the Community edition, but Enterprise being pre-installed
shell: cmd
run: |
mklink /J "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
- name: Build Windows app
run: |
make qt-windows
cd frontends/qt
makensis setup.nsi
- name: Upload Installer
uses: actions/upload-artifact@v4
with:
path: frontends/qt/BitBox-installer.exe
name: BitBoxApp-Windows-${{ github.sha }}.exe

report-artifacts:
needs: [android, qt-linux, macos]
needs: [android, qt-linux, macos, windows]
runs-on: ubuntu-22.04
if: ${{ !cancelled() && github.event_name == 'push' }}
steps:
Expand All @@ -199,24 +243,24 @@ jobs:
if: job.status == 'success'
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
PAYLOAD: |-
{
"channel": "eng-artifacts",
"text": "**New artifacts built**\n([${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}), [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}), [artifacts](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}}#artifacts))\n* Android - [APK](${{needs.android.outputs.artifact-url}})\n* Linux - [AppImage](${{needs.qt-linux.outputs.artifact-url-ai}}), [DEB](${{needs.qt-linux.outputs.artifact-url-deb}}), [RPM](${{needs.qt-linux.outputs.artifact-url-rpm}})\n* MacOS - [Zip](${{needs.macos.outputs.artifact-url}})",
"icon_emoji": "white_check_mark",
"props": {"card": "Repository: [${{ github.repository }}](https://github.com/${{ github.repository }})"}
}
MATTERMOST_ICON_URL: https://cdn4.iconfinder.com/data/icons/basic-ui-2-line/32/check-mark-checklist-complete-done-512.png
MATTERMOST_CHANNEL: eng-artifacts
TEXT: |
**New artifacts built**
([${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}), [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}), [artifacts](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}}#artifacts))
* Android - [APK](${{needs.android.outputs.artifact-url}})
* Linux - [AppImage](${{needs.qt-linux.outputs.artifact-url-ai}}), [DEB](${{needs.qt-linux.outputs.artifact-url-deb}}), [RPM](${{needs.qt-linux.outputs.artifact-url-rpm}})
* MacOS - [Zip](${{needs.macos.outputs.artifact-url}})
* Windows - [EXE](${{needs.windows.outputs.artifact-url}})

- name: Message for failure
uses: mattermost/action-mattermost-notify@master
continue-on-error: true
if: job.status == 'failure'
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
PAYLOAD: |-
{
"channel": "eng-build-failures",
"text": "**Oh no! [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) failed to build.**\nSee [run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) form more details.",
"icon_emoji": "warning",
"props": {"card": "Repository: [${{ github.repository }}](https://github.com/${{ github.repository }})\n\nbranch: [${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }})\n\ncommit: [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})"}
}
MATTERMOST_ICON_URL: https://cdn4.iconfinder.com/data/icons/basic-ui-2-line/32/exclamation-mark-triangle-sign-caution-1024.png
MATTERMOST_CHANNEL: eng-build-failures
TEXT: |
**Oh no! [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) failed to build.**
See [run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ linters:
- wsl
- execinquery
- ireturn
- copyloopvar
- exportloopref
- intrange
- wrapcheck
- varnamelen
Expand Down
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
# Changelog

## Unreleased
- Fix long transaction notes to show fully on multiple lines when necessary
- Improve send-to-self transactions in account overview
- Use native scrollbars on macOS, iOS and Android

# 4.46.3
- Fix camera access on linux

# 4.46.2
- Fix Linux blank screen issue related to the local mimetype database

# 4.46.1
- Fix Android app crash on old Android versions

# 4.46.0
- Android: enable export logs feature
- Label UTXOs that were created as change, as such, in coin control
- Remove support for deprecated the Ethereum Goerli network
- Label change UTXOs as "change" in coin control
- Remove support for the deprecated Ethereum Goerli network
- Revamp transaction history in account overview to improve legibility
- Fix qrscanner when rotating the device or resizing the window
- macOS: create a universal build that runs natively on arm64 and amd64
- Show fiat amount at the time of the transaction in transaction history
- Add BTC Direct private trading desk information
- Android: fix stuck back button after closing a dialog
- Fix authentication view glitch at startup
- Remove "No priority" from fee options
- Display skeleton screens (placeholder) in the account page during data loading to enhance UX
- Fix Moonpay widget loading issues

# 4.45.0
- Bundle BitBox02 firmware version v9.21.0
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ catch:
envinit:
# Keep golangci-lint version in sync with what's in .github/workflows/ci.yml.
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.61.0
go install github.com/vektra/mockery/v2@latest
go install github.com/matryer/moq@latest
go install github.com/vektra/mockery/v2@v2.46.0
go install github.com/matryer/moq@v0.4.0
go install golang.org/x/tools/cmd/goimports@latest
$(MAKE) gomobileinit
gomobileinit:
Expand Down
2 changes: 0 additions & 2 deletions backend/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ func (backend *Backend) initPersistedAccounts() {
// will not be loaded, unless they have been marked as watch-only.
outer:
for _, account := range backend.filterAccounts(&persistedAccounts, keystoreConnectedOrWatch) {
account := account
coin, err := backend.Coin(account.CoinCode)
if err != nil {
backend.log.Errorf("skipping persisted account %s/%s, could not find coin",
Expand Down Expand Up @@ -1379,7 +1378,6 @@ func (backend *Backend) ReinitializeAccounts() {
func (backend *Backend) uninitAccounts(force bool) {
keep := []accounts.Interface{}
for _, account := range backend.accounts {
account := account

belongsToKeystore := false
if backend.keystore != nil {
Expand Down
7 changes: 0 additions & 7 deletions backend/accounts/feetarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func NewFeeTargetCode(code string) (FeeTargetCode, error) {
case string(FeeTargetCodeMempoolFastest):
case string(FeeTargetCodeMempoolHalfHour):
case string(FeeTargetCodeMempoolHour):
case string(FeeTargetCodeMempoolEconomy):
default:
return "", errp.WithStack(errp.Newf("Unrecognized fee target code %s", code))
}
Expand Down Expand Up @@ -72,9 +71,6 @@ const (
// FeeTargetCodeMempoolHour is the mempool hour fee target.
FeeTargetCodeMempoolHour FeeTargetCode = "mHour"

// FeeTargetCodeMempoolEconomy is the mempool economy fee target.
FeeTargetCodeMempoolEconomy FeeTargetCode = "mEconomy"

// FeeTargetCodeCustom means that the actual feerate is supplied separately instead of being
// estimated automatically.
FeeTargetCodeCustom FeeTargetCode = "custom"
Expand All @@ -92,7 +88,6 @@ type MempoolSpaceFees struct {
FastestFee int64 `json:"fastestFee"`
HalfHourFee int64 `json:"halfHourFee"`
HourFee int64 `json:"hourFee"`
EconomyFee int64 `json:"economyFee"`
MinimumFee int64 `json:"minimumFee"`
}

Expand All @@ -106,8 +101,6 @@ func (fees MempoolSpaceFees) GetFeeRate(code FeeTargetCode) btcutil.Amount {
feeRatePerByte = fees.HalfHourFee
case FeeTargetCodeMempoolHour:
feeRatePerByte = fees.HourFee
case FeeTargetCodeMempoolEconomy:
feeRatePerByte = fees.EconomyFee
}
return btcutil.Amount(feeRatePerByte * 1000)
}
1 change: 0 additions & 1 deletion backend/aopp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ func TestAOPPSuccess(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run("", func(t *testing.T) {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, "POST", r.Method)
Expand Down
2 changes: 0 additions & 2 deletions backend/coins/btc/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ func (account *Account) Initialize() error {
account.coin.Blockchain(), account.notifier, account.log)

for _, signingConfiguration := range signingConfigurations {
signingConfiguration := signingConfiguration

var subacc subaccount
subacc.signingConfiguration = signingConfiguration
Expand Down Expand Up @@ -496,7 +495,6 @@ func (account *Account) feeTargets() FeeTargets {
var feeTargets FeeTargets
if mempoolFees != nil {
feeTargets = FeeTargets{
{blocks: 12, code: accounts.FeeTargetCodeMempoolEconomy},
{blocks: 3, code: accounts.FeeTargetCodeMempoolHour},
{blocks: 2, code: accounts.FeeTargetCodeMempoolHalfHour},
{blocks: 1, code: accounts.FeeTargetCodeMempoolFastest},
Expand Down
5 changes: 0 additions & 5 deletions backend/coins/btc/db/transactionsdb/transactionsdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,10 @@ func TestTxQuick(t *testing.T) {
) bool {
txInRefs := make([]*wire.TxIn, len(txIns))
for k, v := range txIns {
v := v
txInRefs[k] = &v
}
txOutRefs := make([]*wire.TxOut, len(txOuts))
for k, v := range txOuts {
v := v
txOutRefs[k] = &v
}
expectedTx := &wire.MsgTx{
Expand Down Expand Up @@ -248,7 +246,6 @@ func TestTxQuick(t *testing.T) {
require.NoError(t, quick.Check(f, nil))

for txHash := range allUnverifiedTxHashes {
txHash := txHash
t.Run("", func(t *testing.T) {
expectedHeaderTimestamp := time.Unix(time.Now().Unix(), 123)
require.NoError(t, tx.MarkTxVerified(txHash, expectedHeaderTimestamp))
Expand Down Expand Up @@ -348,7 +345,6 @@ func TestInputQuick(t *testing.T) {
require.NoError(t, quick.Check(f, nil))

for _, outPoint := range allOutpoints {
outPoint := outPoint
t.Run("", func(t *testing.T) {
tx.DeleteInput(outPoint)
txHash, err := tx.Input(outPoint)
Expand Down Expand Up @@ -447,7 +443,6 @@ func TestOutputsQuick(t *testing.T) {

// Test deletion
for outPoint := range allOutputs {
outPoint := outPoint
t.Run("", func(t *testing.T) {
delete(allOutputs, outPoint)
tx.DeleteOutput(outPoint)
Expand Down
1 change: 0 additions & 1 deletion backend/coins/btc/electrum/electrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func NewElectrumConnection(serverInfos []*config.ServerInfo, log *logrus.Entry,
retryTimeout := 30 * time.Second

for _, serverInfo := range serverInfos {
serverInfo := serverInfo
servers = append(servers, &failover.Server[*client]{
Name: serverInfo.Server,
Connect: func() (*client, error) {
Expand Down
2 changes: 0 additions & 2 deletions backend/coins/btc/electrum/electrum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestDownloadCert(t *testing.T) {
{"1.2.3.4:123", ""},
}
for _, testcase := range tt {
testcase := testcase
t.Run(testcase.targetServer, func(t *testing.T) {
// Set up a fake ElectrumX node.
var didHandshake bool
Expand Down Expand Up @@ -84,7 +83,6 @@ func TestEstablishConnectionTLS(t *testing.T) {
{"1.2.3.4:123", ""},
}
for _, testcase := range tt {
testcase := testcase
t.Run(testcase.targetServer, func(t *testing.T) {
// Set up a fake ElectrumX node.
var didHandshake bool
Expand Down
8 changes: 2 additions & 6 deletions backend/coins/btc/feetarget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func TestFeeTargets(t *testing.T) {

// non-empty slice, with all nil feeRates
feeTargets = FeeTargets{
{blocks: 12, code: accounts.FeeTargetCodeMempoolEconomy},
{blocks: 3, code: accounts.FeeTargetCodeMempoolHour},
{blocks: 2, code: accounts.FeeTargetCodeMempoolHalfHour},
{blocks: 1, code: accounts.FeeTargetCodeMempoolFastest},
Expand All @@ -72,7 +71,6 @@ func TestFeeTargets(t *testing.T) {

// non-empty slice, with all nil feeRates
feeTargets = FeeTargets{
{blocks: 12, code: accounts.FeeTargetCodeMempoolEconomy},
{blocks: 3, code: accounts.FeeTargetCodeMempoolHour},
{blocks: 2, code: accounts.FeeTargetCodeMempoolHalfHour},
{blocks: 1, code: accounts.FeeTargetCodeMempoolFastest},
Expand All @@ -81,22 +79,20 @@ func TestFeeTargets(t *testing.T) {

// non-empty slice, with some nil feeRates
feeTargetsSlice := []*FeeTarget{
{blocks: 12, code: accounts.FeeTargetCodeMempoolEconomy},
{blocks: 3, code: accounts.FeeTargetCodeMempoolHour, feeRatePerKb: amt(12)},
{blocks: 2, code: accounts.FeeTargetCodeMempoolHalfHour},
{blocks: 1, code: accounts.FeeTargetCodeMempoolFastest, feeRatePerKb: amt(123)},
}
feeTargets = feeTargetsSlice
require.Equal(t, feeTargetsSlice[3], feeTargets.highest())
require.Equal(t, feeTargetsSlice[2], feeTargets.highest())

// non-empty slice, with unsorted not-nil feeRates
feeTargetsSlice = []*FeeTarget{
{blocks: 3, code: accounts.FeeTargetCodeMempoolHour, feeRatePerKb: amt(12)},
{blocks: 12, code: accounts.FeeTargetCodeMempoolEconomy, feeRatePerKb: amt(1)},
{blocks: 1, code: accounts.FeeTargetCodeMempoolFastest, feeRatePerKb: amt(1234)},
{blocks: 2, code: accounts.FeeTargetCodeMempoolHalfHour, feeRatePerKb: amt(123)},
}
feeTargets = feeTargetsSlice
require.Equal(t, feeTargetsSlice[2], feeTargets.highest())
require.Equal(t, feeTargetsSlice[1], feeTargets.highest())

}
2 changes: 1 addition & 1 deletion backend/coins/btc/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ func (handlers *Handlers) getTxInfoJSON(txInfo *accounts.TransactionData, detail
Time: formattedTime,
Addresses: addresses,
Note: handlers.account.TxNote(txInfo.InternalID),
Fee: feeString,
}

if detail {
txInfoJSON.Fee = feeString
switch handlers.account.Coin().(type) {
case *btc.Coin:
txInfoJSON.VSize = txInfo.VSize
Expand Down
2 changes: 0 additions & 2 deletions backend/coins/btc/maketx/maketx.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ func NewTxSpendAll(
previousOutputs := make(PreviousOutputs, len(spendableOutputs))
outputsSum := btcutil.Amount(0)
for outPoint, output := range spendableOutputs {
outPoint := outPoint // avoid reference reuse due to range loop
selectedOutPoints = append(selectedOutPoints, outPoint)
outputsSum += btcutil.Amount(output.TxOut.Value)
inputs = append(inputs, wire.NewTxIn(&outPoint, nil, nil))
Expand Down Expand Up @@ -272,7 +271,6 @@ func NewTx(
inputs := make([]*wire.TxIn, len(selectedOutPoints))
previousOutputs := make(PreviousOutputs, len(selectedOutPoints))
for i, outPoint := range selectedOutPoints {
outPoint := outPoint // avoids referencing the same variable across loop iterations
inputs[i] = wire.NewTxIn(&outPoint, nil, nil)
previousOutputs[outPoint] = &transactions.SpendableOutput{
TxOut: spendableOutputs[outPoint].TxOut,
Expand Down
3 changes: 0 additions & 3 deletions backend/coins/btc/maketx/txsize_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,11 @@ func TestEstimateTxSize(t *testing.T) {
}

for _, useSegwit := range []bool{false, true} {
useSegwit := useSegwit
for _, outputScriptType := range scriptTypes {
outputScriptType := outputScriptType
t.Run(fmt.Sprintf("output=%s,noChange,segwit=%v", outputScriptType, useSegwit), func(t *testing.T) {
testEstimateTxSize(t, useSegwit, outputScriptType, "")
})
for _, changeScriptType := range scriptTypes {
changeScriptType := changeScriptType
t.Run(fmt.Sprintf("output=%s,change=%s,segwit=%v", outputScriptType, changeScriptType, useSegwit), func(t *testing.T) {
testEstimateTxSize(t, useSegwit, outputScriptType, changeScriptType)
})
Expand Down
2 changes: 0 additions & 2 deletions backend/coins/coin/amount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (

func TestNewAmountFromString(t *testing.T) {
for decimals := 0; decimals <= 20; decimals++ {
decimals := decimals // avoids referencing the same variable across loop iterations
unit := new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil)
t.Run(fmt.Sprintf("decimals=%d", decimals), func(t *testing.T) {
require.NoError(t, quick.Check(func(amount int64) bool {
Expand All @@ -46,7 +45,6 @@ func TestNewAmountFromString(t *testing.T) {
"1/1000",
"0.123456789", // only up to 8 decimals allowed
} {
fail := fail // avoids referencing the same variable across loop iterations
t.Run(fail, func(t *testing.T) {
_, err := coin.NewAmountFromString(fail, big.NewInt(1e8))
require.Error(t, err)
Expand Down
Loading
Loading