Skip to content

ethclient: fix unmarshaling of ethereum.SyncProgress#24199

Merged
fjl merged 1 commit intoethereum:masterfrom
fjl:sync-progress
Jan 5, 2022
Merged

ethclient: fix unmarshaling of ethereum.SyncProgress#24199
fjl merged 1 commit intoethereum:masterfrom
fjl:sync-progress

Conversation

@fjl
Copy link
Copy Markdown
Contributor

@fjl fjl commented Jan 5, 2022

SyncProgress was modified in PR #23576 to add the fields reported for
snap sync. The PR also changed ethclient to use the SyncProgress struct
directly instead of wrapping it for hex-decoding. This broke the
SyncProgress method.

Fix it by putting back the custom wrapper. While here, also put back the
fast sync related fields because SyncProgress is stable API and thus
removing fields is not allowed.

Fixes #24180

SyncProgress was modified in PR ethereum#23576 to add the fields reported for
snap sync. The PR also changed ethclient to use the SyncProgress struct
directly instead of wrapping it for hex-decoding. This broke the
SyncProgress method.

Fix it by putting back the custom wrapper. While here, also put back the
fast sync related fields because SyncProgress is stable API and thus
removing fields is not allowed.
@fjl fjl requested a review from karalabe January 5, 2022 14:13
@fjl fjl added this to the 1.10.15 milestone Jan 5, 2022
Comment thread ethclient/ethclient.go
}

// rpcProgress is a copy of SyncProgress with hex-encoded fields.
type rpcProgress struct {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't these have json tags?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They didn't have before because all the fields work with the default mapping, and this struct is only used for decoding.

Copy link
Copy Markdown
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@fjl fjl merged commit 0169d57 into ethereum:master Jan 5, 2022
@jclapis
Copy link
Copy Markdown

jclapis commented Jan 5, 2022

Thanks everyone!

sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Jan 6, 2022
SyncProgress was modified in PR ethereum#23576 to add the fields reported for
snap sync. The PR also changed ethclient to use the SyncProgress struct
directly instead of wrapping it for hex-decoding. This broke the
SyncProgress method.

Fix it by putting back the custom wrapper. While here, also put back the
fast sync related fields because SyncProgress is stable API and thus
removing fields is not allowed.

Fixes ethereum#24180
Fixes ethereum#24176
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
SyncProgress was modified in PR ethereum#23576 to add the fields reported for
snap sync. The PR also changed ethclient to use the SyncProgress struct
directly instead of wrapping it for hex-decoding. This broke the
SyncProgress method.

Fix it by putting back the custom wrapper. While here, also put back the
fast sync related fields because SyncProgress is stable API and thus
removing fields is not allowed.

Fixes ethereum#24180
Fixes ethereum#24176
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Aug 21, 2025
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Aug 22, 2025
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.

SyncProgress() fails unmarshalling in Geth v1.10.14

4 participants