Skip to content
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

Add new option --maxorphantx #419

Merged
merged 1 commit into from
May 12, 2015
Merged

Add new option --maxorphantx #419

merged 1 commit into from
May 12, 2015

Conversation

dajohi
Copy link
Member

@dajohi dajohi commented May 5, 2015

The option --maxorphantx allows the user to specify the number of
orphan transactions to keep in memory.

@@ -600,6 +602,16 @@ func loadConfig() (*config, []string, error) {
return nil, nil, err
}

// Limit the max orphan count to a sane vlue.
if cfg.MaxOrphanTxs < 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest making the config option a uint32 so the parser will prevent negatives for you.

Copy link
Member Author

Choose a reason for hiding this comment

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

That produces ugly help output and also requires casting then.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough. I prefer to use appropriate types in general (if something can't be negative, make it unsigned), but I suppose the nicer error message is worth it.

@davecgh
Copy link
Member

davecgh commented May 5, 2015

Also, please don't forget that new options need entries in doc.go and sample-btcd.conf.

//
// Note that the number of orphan transactions in the orphan pool is
// also limited, so this equates to a maximum memory used of
// maxOrphanTxSize * maxOrphanTransactions (which is 500MB as of the
Copy link
Member

Choose a reason for hiding this comment

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

Please leave the note here. Just modify it to say * cfg.MaxOrphanTransactions and which is 500MB with the default values as of the time this comment was written.

@davecgh davecgh changed the title Add new option -maxorphantx Add new option --maxorphantx May 5, 2015
@@ -81,7 +81,8 @@ Application Options:
--limitfreerelay= Limit relay of transactions with no transaction fee
to the given amount in thousands of bytes per minute
(15)

--maxorphantx= Max number of orphan transactions to keep in memory
(10000)
Copy link
Member

Choose a reason for hiding this comment

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

As discussed, let's lower the default max orphans to 1000 along with this PR.

The option -maxorphantx allows the user to specify the number of
orphan transactions to keep in memory.

Also, lower the default max orphan count from 10000 to 1000.
@davecgh
Copy link
Member

davecgh commented May 12, 2015

OK

@conformal-deploy conformal-deploy merged commit 5f8dbab into btcsuite:master May 12, 2015
@dajohi dajohi deleted the orphan branch October 27, 2015 16:25
cjepson pushed a commit to cjepson/btcd that referenced this pull request Oct 12, 2016
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.

3 participants