-
Notifications
You must be signed in to change notification settings - Fork 16
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
Make network and rpcport configurable rather than hardcoding them #126
Make network and rpcport configurable rather than hardcoding them #126
Conversation
Looks good! I think the p2p port should also be exposed right? List<Integer> hardcodedStandardPorts = ImmutableList.<Integer>builder()
.addAll(this.properties.getChain() == Chain.mainnet ? Lists.newArrayList(8332, 8333) : Collections.emptyList())
.addAll(this.properties.getChain() == Chain.testnet ? Lists.newArrayList(18332, 18333) : Collections.emptyList())
.addAll(this.properties.getChain() == Chain.regtest ? Lists.newArrayList(18443, 18444) : Collections.emptyList())
.build(); Also, if
What do you think? |
Thanks for the feedback! And then those defaults are effectively used in setting the exposed ports for the testcontainer: I could add a P2P port property to the properties class: But I think you are also saying you'd like to be able to have logic to determine what the default ports are based on Network? If Regtest (default), then 18443 and 18444. If mainnet, then 8332 and 8333, etc. Is that right? If so, I can certainly do that. Also, I'm assuming in the case RPC port is provided, but P2P port is blank, I should use the default P2P port for the network. Then I would probably add a PostConstruct method to check what the Network is and set the ports based on that. But the default would be Regtest. And then add those in the exposedPorts List: What do you think? |
👍
Yes.
That is what I was thinking, yes. What do you think?
Currently, most default values of classes with I like that more than
Nice. If |
Update: I am working this, and sorry for the delay! I'm so close to having it done, but am now having trouble with the unit tests in testcontainer. When running a test with mainnet or testnet configuration, the container times out:
Not sure in this case where port 56180 is coming from, since I am setting 8332 and 8333 for Mainnet. I'm new to Testcontainers, so I might be missing something. Will keep you posted |
Hey @jump-kick, take your time! No urgency involved. Do not be afraid of pushing your changes - I'd love to review them 🙌 |
Ha, thanks for your patience! I just pushed another commit for your review. The failing tests were two new ones I added, 'defaultMainnetValuesTest' and 'defaultTestnetValuesTest' where I set the network to 'mainnet' and 'testnet'. THEN, I noticed the comment in BitcoindTestcontainerAutoConfiguration that says "NOTE: Currently only really supports creating "regtest" container. Defaults do not play nicely with mainnet/testnet -> "networkactive" is disabled." That seemed to be my experience, too, so I tried a way to do the unit tests where the testcontainer is not started; although maybe that defeats the purpose of this project, haha. oh well. See 'defaultMainnetValuesTest' and 'defaultTestnetValuesTest'. Now I don't have the testcontainer problem where it times out waiting for a port to open, but there is some weird bug where the 'network' property is not being set, and it keeps returning the default 'regtest'. I'm sure it's something obvious and I will kick myself when I realize the problem = ). |
oh yeah, and I like your idea of putting the default logic in the getters, so I went ahead with that. |
@jump-kick So nice! I think I will have time to review it next week. Is it okay to push some changes (e.g. remove logging in property class) or do you favor that I describe them here and you "fix" them yourself? Thank you so much 🙏 |
Yes, please feel free to push any changes you have! I fixed a thing or two
after pushing this, but still having unit test issues. Hope to push some
changes myself tomorrow, and I can remove that logging if you don't get to
it first.
…On Sat, May 4, 2024, 8:09 AM Thebora Kompanioni ***@***.***> wrote:
@jump-kick <https://github.com/jump-kick> So nice!
I think I will have time to review it next week. Is it okay to push some
changes (e.g. remove logging in property class) or do you favor that I
describe them here and you "fix" them yourself? Thank you so much 🙏
—
Reply to this email directly, view it on GitHub
<#126 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGUKH7OJJMLN2HW4GN5763DZATFWTAVCNFSM6AAAAABGIMEE5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUGE2DCNZQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
.com>
|
PR against your branch: jump-kick#1 |
chore: pass port and rpcport arg to bitcoin testcontainer
@jump-kick What do you think.. should |
Yes, I like that idea! I was thinking I could implement those changes and
then add them to the branch/PR and make it official. I could have that
done within a couple of days.
…On Tue, May 28, 2024 at 4:24 AM Thebora Kompanioni ***@***.***> wrote:
@jump-kick <https://github.com/jump-kick> What do you think.. should
p2pport be renamed to port and network to chain?
—
Reply to this email directly, view it on GitHub
<#126 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGUKH7PGVLROBK6OBVM4ZWLZEQ5MVAVCNFSM6AAAAABGIMEE5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUGYZDOMBUGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
.com>
|
Nice! Take your time - there is no urgency involved. Looking forward to your contribution 🧡 |
One quick question, @theborakompanioni - can you confirm this is right? Line 73 in 3a2c2f7
Line 74 in 3a2c2f7
"main" vs. "mainnet" and "test" vs. "testnet" for the Enum String property? |
Yeah, you are right - consistent would be to make them the same values as Bitcoin Core. However, they are named like they are now through-out other modules as well. I'd say let's keep it like it is and maybe think about a rectification of all properties in a follow-up ticket/PR. Okay for you? I think this should be merged soon. |
Sounds good to me! Thanks |
Nice. Will merge this now into Thank you so much for your contribution @jump-kick 🚀 🚀 🚀 |
Daaamn. Did not look at the target branch and merged into |
Fixed 🙏 |
d'oh! Sorry if I put the wrong branch there! Thanks!! |
Fixes #56.