Skip to content

Commit 7cd8248

Browse files
dajohijrick
authored andcommitted
linter: fixes
1 parent c6e7b5f commit 7cd8248

File tree

8 files changed

+16
-85
lines changed

8 files changed

+16
-85
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
with:
1717
go-version: ${{ matrix.go }}
1818
- name: Check out source
19-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0
19+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 #v3.5.0
2020
- name: Build
2121
run: go build ./...
2222
- name: Test

p2p/peering.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,6 @@ func (rp *RemotePeer) HeadersAsync(ctx context.Context, blockLocators []*chainha
16531653
stalled.Stop()
16541654
return rp.err
16551655
case out <- &msgAck{m, nil}:
1656-
out = nil
16571656
return nil
16581657
}
16591658
}

rpc/client/dcrd/calls.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ func (r *RPC) ExistsLiveTicket(ctx context.Context, ticket *chainhash.Hash) (boo
9696
func (r *RPC) ExistsLiveExpiredTickets(ctx context.Context, tickets []*chainhash.Hash) (live, _ bitset.Bytes, err error) {
9797
const op errors.Op = "dcrd.ExistsLiveExpiredTickets"
9898
// Reuse the single json.RawMessage for both calls
99-
ticketArray, _ := json.Marshal(hashSliceToStrings(tickets))
99+
ticketArray, err := json.Marshal(hashSliceToStrings(tickets))
100+
if err != nil {
101+
return nil, nil, err
102+
}
100103
errs := make(chan error, 1)
101104
go func() { errs <- exists(ctx, r, "existslivetickets", &live, ticketArray) }()
102105
for i := 0; i < cap(errs); i++ {
@@ -124,9 +127,12 @@ func (r *RPC) ExistsExpiredMissedTickets(ctx context.Context, tickets []*chainha
124127
// existsaddress index to be enabled.
125128
func (r *RPC) UsedAddresses(ctx context.Context, addrs []stdaddr.Address) (bitset.Bytes, error) {
126129
const op errors.Op = "dcrd.UsedAddresses"
127-
addrArray, _ := json.Marshal(addrSliceToStrings(addrs))
130+
addrArray, err := json.Marshal(addrSliceToStrings(addrs))
131+
if err != nil {
132+
return nil, errors.E(op, err)
133+
}
128134
var bits bitset.Bytes
129-
err := exists(ctx, r, "existsaddresses", &bits, addrArray)
135+
err = exists(ctx, r, "existsaddresses", &bits, addrArray)
130136
if err != nil {
131137
return nil, errors.E(op, err)
132138
}
@@ -137,9 +143,12 @@ func (r *RPC) UsedAddresses(ctx context.Context, addrs []stdaddr.Address) (bitse
137143
// currently live.
138144
func (r *RPC) ExistsLiveTickets(ctx context.Context, tickets []*chainhash.Hash) (bitset.Bytes, error) {
139145
const op errors.Op = "dcrd.ExistsLiveTickets"
140-
ticketArray, _ := json.Marshal(hashSliceToStrings(tickets))
146+
ticketArray, err := json.Marshal(hashSliceToStrings(tickets))
147+
if err != nil {
148+
return nil, errors.E(op, err)
149+
}
141150
var bits bitset.Bytes
142-
err := exists(ctx, r, "existslivetickets", &bits, ticketArray)
151+
err = exists(ctx, r, "existslivetickets", &bits, ticketArray)
143152
if err != nil {
144153
return nil, errors.E(op, err)
145154
}

wallet/addresses.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -691,75 +691,6 @@ func (w *Wallet) AddressAtIdx(ctx context.Context, account, branch,
691691
return addr, nil
692692
}
693693

694-
func (w *Wallet) nextImportedXpubAddress(ctx context.Context, op errors.Op,
695-
maybeDBTX walletdb.ReadWriteTx, accountName string, account uint32, branch uint32,
696-
callOpts ...NextAddressCallOption) (addr stdaddr.Address, err error) {
697-
698-
dbtx := maybeDBTX
699-
if dbtx == nil {
700-
dbtx, err = w.db.BeginReadWriteTx()
701-
if err != nil {
702-
return nil, err
703-
}
704-
defer func() {
705-
if err == nil {
706-
err = dbtx.Commit()
707-
} else {
708-
dbtx.Rollback()
709-
}
710-
}()
711-
}
712-
713-
ns := dbtx.ReadWriteBucket(waddrmgrNamespaceKey)
714-
xpub, err := w.manager.AccountExtendedPubKey(dbtx, account)
715-
if err != nil {
716-
return nil, errors.E(op, err)
717-
}
718-
props, err := w.manager.AccountProperties(ns, account)
719-
branchKey, err := xpub.Child(branch)
720-
if err != nil {
721-
return nil, errors.E(op, err)
722-
}
723-
var childKey *hdkeychain.ExtendedKey
724-
var child uint32
725-
switch branch {
726-
case 0:
727-
child = props.LastReturnedExternalIndex + 1
728-
case 1:
729-
child = props.LastReturnedInternalIndex + 1
730-
default:
731-
return nil, errors.E(op, "branch is required to be 0 or 1")
732-
}
733-
for {
734-
childKey, err = branchKey.Child(child)
735-
if err == hdkeychain.ErrInvalidChild {
736-
child++
737-
continue
738-
}
739-
if err != nil {
740-
return nil, errors.E(op, err)
741-
}
742-
break
743-
}
744-
pkh := dcrutil.Hash160(childKey.SerializedPubKey())
745-
apkh, err := stdaddr.NewAddressPubKeyHashEcdsaSecp256k1V0(pkh, w.chainParams)
746-
if err != nil {
747-
return nil, errors.E(op, err)
748-
}
749-
addr = &xpubAddress{
750-
AddressPubKeyHashEcdsaSecp256k1V0: apkh,
751-
xpub: xpub,
752-
account: account,
753-
branch: branch,
754-
child: child,
755-
}
756-
err = w.manager.MarkReturnedChildIndex(dbtx, account, branch, child)
757-
if err != nil {
758-
return nil, errors.E(op, err)
759-
}
760-
return addr, nil
761-
}
762-
763694
func minUint32(a, b uint32) uint32 {
764695
if a < b {
765696
return a

wallet/mixing_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func MsgTxFromHex(hexTx string) (*wire.MsgTx, error) {
1919
}
2020

2121
func TestIsMixTx(t *testing.T) {
22+
t.Parallel()
2223

2324
// 11x 2.68435456
2425
tx0, err := MsgTxFromHex(mix0Hex)

wallet/udb/addressdb.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ type dbBIP0044AccountRow struct {
7272
lastReturnedExternalIndex uint32 // Added in version 5
7373
lastReturnedInternalIndex uint32 // Added in version 5
7474
name string
75-
76-
// variables subbucket is used to record remaining fields
77-
uniqueKey *kdf.Argon2idParams
7875
}
7976

8077
func (r *dbBIP0044AccountRow) accountType() accountType { return actBIP0044Legacy }

wallet/udb/txdb.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,10 +1667,6 @@ func (it *unminedCreditIterator) next() bool {
16671667
// return nil
16681668
// }
16691669

1670-
func (it *unminedCreditIterator) reposition(txHash *chainhash.Hash, index uint32) {
1671-
it.c.Seek(canonicalOutPoint(txHash, index))
1672-
}
1673-
16741670
func (it *unminedCreditIterator) close() {
16751671
if it.c == nil {
16761672
return

wallet/udb/upgrades_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ var dbUpgradeTests = [...]struct {
4444
var pubPass = []byte("public")
4545

4646
func TestUpgrades(t *testing.T) {
47-
t.Parallel()
48-
4947
ctx := context.Background()
5048
d, err := os.MkdirTemp("", "dcrwallet_udb_TestUpgrades")
5149
if err != nil {

0 commit comments

Comments
 (0)