-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth, internal/web3ext: add optional first and last arguments to the admin_exportChain
RPC.
#20107
Conversation
I don't see a reason for adding a new method for this. You can add 2 more optional parameters to the existing |
Ah ok I didn’t realize that pointers were interpreted as optionals. Do I
need to do anything special in web3ext to support this?
…On Thu, Sep 26, 2019 at 4:47 AM Péter Szilágyi ***@***.***> wrote:
I don't see a reason for adding a new method for this. You can add 2 more
optional parameters to the existing admin_exportChain (*uint64 types).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#20107?email_source=notifications&email_token=AAANCEBHFCWFK5FEHQBD663QLSOMRA5CNFSM4IY3K5WKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7VJC5A#issuecomment-535466356>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAANCEBKHOCRZXUFZLRAKCDQLSOMRANCNFSM4IY3K5WA>
.
|
93ea2c7
to
353347c
Compare
admin_exportBlocks
RPC to export a range of blocks.admin_exportChain
RPC.
Ok @karalabe I've force pushed 353347c which adds the first and last as arguments to the admin_exportChain RPC. As far as I can tell I don't need to do anything special to support them as optional arguments, all cases worked as expected for me with the console:
|
eth/api.go
Outdated
// ExportChain exports the current blockchain into a local file, | ||
// or a range of blocks if first and last are non-nil | ||
func (api *PrivateAdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool, error) { | ||
if first != nil && last == nil || first == nil && last != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not let only the first
be specified and from that point onward export the entire chain till head? Seems more robust to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean when first
is set and last
is nil? Ya, I can see that being useful. I'll update the PR to support that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, force pushed 947c62b which supports this behavior:
> admin.exportChain("/tmp/1332997.gz", 1332997, 1333000)
true
> admin.exportChain("/tmp/latest.gz", 1724972)
true
> admin.exportChain("/tmp/bad.gz", null, 1333000)
Error: last cannot be specified without first
at web3.js:3143:20
at web3.js:6347:15
at web3.js:5081:36
at <anonymous>:1:1
…admin_exportChain` RPC.
353347c
to
947c62b
Compare
…admin_exportChain` RPC. (ethereum#20107)
I was playing w/ the block importing/exporting logic today to get a better understanding of how it worked, and realized that the only way currently to export blocks is to use
admin_exportChain
(which exports the entire chain) orgeth export
(which requires the node to be stopped since only one process can have access to the leveldb).So, this simply adds a new
admin_exportBlocks
RPC that takes the same arguments asgeth export
but can be done while the node is running.