-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat(cli): publish to multiple nodes #229
Conversation
@steinerkelvin nice. yeah I wanted to display a real error message, but discovered that Err was empty, so I just left it as-is. |
One thing I noticed is this doesn't ensure the main API host is included. Hum. One todo: the |
I named the param --host because latest clap seems to strongly prefer (maybe require?) that Vec<> args are passed as |
I initially appended the --api host to the peer list. However, I found it was duplicated because the call to client.getpeers was returning it, so I dropped that code. Now after I pulled the latest commits to this branch, I find that |
We could just add if it's missing?
Yeah, you just stumbled in the exact case in that this would be relevant: your own node isn't in the peers' list, because other you don't have other peers broadcasting that address to yourself. On a side note, I wonder if a node could be aware an address points to itself without hardcoding it. I've bumped the
also, maybe a dedicated text channel for these updates / resets. |
Addresses Kindelia#173. modifies the publish command to first query "our" node for its peers and then concurrently publish to each peer. This is just a temporary feature until the p2p layer properly transmits code between nodes.
Also fixes a bug where localhost url was used instead of peer url.
45f6aea
to
8d010be
Compare
When publishing "our" node may not be present in the node list. So we look for it, and add if not present.
8d010be
to
e31dfcf
Compare
done.
implemented. This PR is feature complete now afaict and ready for review. One thing that still bothers me is that I see different behavior when publishing dup transactions to my local node vs remote nodes. 1st run, no dups:
2nd run, tx #0 is a dup:
So 127.0.0.1 rejects tx #0 as a dup, but 64.227.110.69 and 188.166.3.140 accept it. I'm wondering if perhaps those peers are running older code that doesn't do any dup detection? |
Running `/home/michiru/Kindelia/target/debug/kindelia publish kinguFun.kdl`
thread 'main' panicked at 'Command publish: Short option names must be unique for each argument, but '-h' is in use by
both 'host' and 'help' (call `cmd.disable_help_flag(true)` to remove the auto-generated `--help`)',
/home/michiru/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-4.0.22/src/builder/debug_asserts.rs:121:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace apparently the |
the publish -h flag intended as shortopt for --hosts conflicted with shortopt -h for --help causing an error message.
@kings177 thx. I've removed the publish -h shortopt for now. It might make sense to think of another shortopt, perhaps renaming
|
Perhaps it could be |
I will investigate this |
I considered this. My reasoning is that nodes are peers of eachother, but the cli is a client of a node... often the localhost node but potentially any node. So they are not peers to the cli. (except in the context of stated differently, So that's why I thought maybe Just figured I should share my thought process. Also, regarding plural vs singular eg Please let me know if you still want |
From what I saw the nodes are doing this detection. The code that makes it (in the What may have happened is that nodes other than localhost have already mined its transactions and therefore removed this transaction from the mempool, thus allowing their reinsertion. |
Yes, I see what you meant and it makes sense. My preference is to stick with It looks like Do you think it's a good idea to just leave |
Nice find, it works. I also tried I changed the help text to:
btw the space separated values used to be the default for Vec args in structopt, but when structopt was recently merged into clap, they made this change. afaict from looking at clap github issues, the reasoning is that "the unix way" is to use multi occurence args, eg: Ok, so with that background in mind...
I think it depends on if we want to use/document the multi occurrence args. In particular So then we are back to But... now we have the wrinkle that With all that taken into consideration, my preference is for using
I will push a commit for your consideration. |
Changes: 1) --host --> --node, -n 2) accept comma delimited values eg --node x.x.x.x:8000,y.y.y.y:8000
I'm not sure I understand. So is this is a situation where the network gets out of sync because the p2p layer is not finished? I would think that (non-mining) localhost would be informed by the mining nodes of the new blocks and update its state to match. Also, I just restarted my localhost node with Have you tried publishing to multiple peers, and if so do you see the same behavior? |
Looks good to me, but since we're going to use the comma and make this the standard way, I prefer it to be
What may have happened is that the two other nodes have mined a block that will compete for the end of the chain and these blocks have not yet been included by localhost, which has not mined one of its own (which would remove the transaction from the mempool) and has not received the block mined from other nodes or received and not included (to include a block it is necessary to have its
I tried running
What I think that could have happened is:
To be sure of this we would have to debug these nodes; maybe we could activate the events websocket of these nodes for this purpose. |
This change was requested in PR review: Kindelia#229 (comment)
done.
Ok, I don't know how to go about that, so I think I will leave it in your hands. |
Addresses #173.
modifies the publish command to first query "our" node for its peers and then concurrently publish to each peer.
This is just a temporary feature until the p2p layer properly transmits code between nodes.
notes:
Edit by @steinerkelvin
TODO:
--hosts
CLI parameter to override to which hosts to publish