Skip to content

Commit bb775b2

Browse files
committed
fix: range over int vs loop+increment
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 4e49c68 commit bb775b2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

internal/handshake/block.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (b *Block) Decode(r *bytes.Buffer) error {
4242
if err != nil {
4343
return err
4444
}
45-
for i := uint64(0); i < txCount; i++ {
45+
for range txCount {
4646
var tmpTx Transaction
4747
if err := tmpTx.Decode(r); err != nil {
4848
return err

internal/handshake/covenant.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (c *GenericCovenant) Decode(r io.Reader) error {
4747
if err != nil {
4848
return err
4949
}
50-
for i := uint64(0); i < itemCount; i++ {
50+
for range itemCount {
5151
itemLength, err := binary.ReadUvarint(r.(io.ByteReader))
5252
if err != nil {
5353
return err

internal/handshake/transaction.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (t *Transaction) Decode(r *bytes.Buffer) error {
5353
if err != nil {
5454
return err
5555
}
56-
for i := uint64(0); i < inCount; i++ {
56+
for range inCount {
5757
var tmpInput TransactionInput
5858
if err := tmpInput.Decode(r); err != nil {
5959
return err
@@ -65,7 +65,7 @@ func (t *Transaction) Decode(r *bytes.Buffer) error {
6565
if err != nil {
6666
return err
6767
}
68-
for i := uint64(0); i < outCount; i++ {
68+
for range outCount {
6969
var tmpOutput TransactionOutput
7070
if err := tmpOutput.Decode(r); err != nil {
7171
return err
@@ -87,7 +87,7 @@ func (t *Transaction) Decode(r *bytes.Buffer) error {
8787
origData = make([]byte, r.Len())
8888
copy(origData, r.Bytes())
8989
// Witnesses
90-
for i := uint64(0); i < inCount; i++ {
90+
for i := range inCount {
9191
if err := t.Inputs[i].DecodeWitness(r); err != nil {
9292
return err
9393
}
@@ -141,7 +141,7 @@ func (i *TransactionInput) DecodeWitness(r io.Reader) error {
141141
return err
142142
}
143143
i.Witness = make([][]byte, witnessCount)
144-
for j := uint64(0); j < witnessCount; j++ {
144+
for j := range witnessCount {
145145
itemLength, err := binary.ReadUvarint(r.(io.ByteReader))
146146
if err != nil {
147147
return err

0 commit comments

Comments
 (0)