Skip to content

Conversation

HelloKashif
Copy link
Contributor

@HelloKashif HelloKashif commented Jul 1, 2025

}

func (t *TronTxm) estimateEnergy(tx *TronTx) (int64, error) {
if t.Config.FixedEnergyValue != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth having a nil check somewhere here or applying 0 as the default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be nil? not sure if go typecasts an empty value to 0 (maybe?)

Copy link
Contributor Author

@HelloKashif HelloKashif Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Golang initializes int64 types as zero by default. Here's a sample demo
https://go.dev/play/p/SftdRsxCrxU

@HelloKashif HelloKashif requested a review from KodeyThomas July 1, 2025 07:31
@HelloKashif HelloKashif merged commit f8be142 into main Jul 1, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants