Skip to content

Commit

Permalink
fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
iFrostizz committed Jun 21, 2024
1 parent 307ce16 commit 68b525a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
8 changes: 2 additions & 6 deletions chain/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,7 @@ func UnmarshalTx(
return nil, fmt.Errorf("%w: sponsorType (%d) did not match authType (%d)", ErrInvalidSponsor, sponsorType, authType)
}

var tx Transaction
tx.Timestamp = timestamp
tx.ChainID = chainID
tx.MaximumFee = maxFee
tx.Actions = actions
tx := NewTx(timestamp, chainID, maxFee, actions)
tx.Auth = auth
if err := p.Err(); err != nil {
return nil, p.Err()
Expand All @@ -481,7 +477,7 @@ func UnmarshalTx(
tx.bytes = codecBytes[start:p.Offset()] // ensure errors handled before grabbing memory
tx.size = len(tx.bytes)
tx.id = utils.ToID(tx.bytes)
return &tx, nil
return tx, nil
}

func unmarshalActions(
Expand Down
4 changes: 2 additions & 2 deletions cli/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ type timeModifier struct {
Timestamp int64
}

func (t *timeModifier) Base(b *chain.Transaction) {
b.Timestamp = t.Timestamp
func (t *timeModifier) Base(timestamp *int64, chainID *ids.ID, maxFee *uint64) {

Check failure on line 474 in cli/spam.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

unused-parameter: parameter 'timestamp' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 474 in cli/spam.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

unused-parameter: parameter 'chainID' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 474 in cli/spam.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

unused-parameter: parameter 'maxFee' seems to be unused, consider removing or renaming it as _ (revive)
t.Timestamp = t.Timestamp

Check failure on line 475 in cli/spam.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

assign: self-assignment of t.Timestamp to t.Timestamp (govet)

Check failure on line 475 in cli/spam.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

SA4018: self-assignment of t.Timestamp to t.Timestamp (staticcheck)

Check warning

Code scanning / CodeQL

Self assignment Warning

This statement assigns an
expression
to itself.
}

func startIssuer(cctx context.Context, issuer *txIssuer) {
Expand Down
2 changes: 1 addition & 1 deletion gossiper/manual.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (g *Manual) Force(ctx context.Context) error {
g.vm.GetTargetGossipDuration(),
func(_ context.Context, next *chain.Transaction) (cont bool, rest bool, err error) {
// Remove txs that are expired
if next.Timestamp < now {
if next.Expiry() < now {
return true, false, nil
}

Expand Down
4 changes: 2 additions & 2 deletions gossiper/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ func (g *Proposer) Force(ctx context.Context) error {
g.vm.GetTargetGossipDuration(),
func(_ context.Context, next *chain.Transaction) (cont bool, rest bool, err error) {
// Remove txs that are expired
if next.Timestamp < now {
if next.Expiry() < now {
return true, false, nil
}

// Don't gossip txs that are about to expire
life := next.Timestamp - now
life := next.Expiry() - now
if life < g.cfg.GossipMinLife {
return true, true, nil
}
Expand Down
2 changes: 1 addition & 1 deletion rpc/jsonrpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (cli *JSONRPCClient) SubmitTx(ctx context.Context, d []byte) (ids.ID, error
}

type Modifier interface {
Base(*int64, *ids.ID, *uint64)
Base(timestamp *int64, chainID *ids.ID, maxFee *uint64)
}

func (cli *JSONRPCClient) GenerateTransaction(
Expand Down

0 comments on commit 68b525a

Please sign in to comment.