-
Notifications
You must be signed in to change notification settings - Fork 88
Implement transaction broadcasting for Kyoto #182
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
Implement transaction broadcasting for Kyoto #182
Conversation
c5dd087 to
6f98ece
Compare
tvpeter
left a comment
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.
Probably my network is poor, I have not been able to successfully broadcast a tx but will keep trying.
Thank you for helping with this.
I am working now to improve the broadcasting reliability in Kyoto, so there is a chance you are running into bugs of mine. However the code here wouldn't change, only internals of the node. |
Would that require updating |
|
I believe |
|
I also was unable to get it to broadcast (I'm using testnet4). It looks like it's never getting to this line: tracing::info!("Successfully gossiped wtxid: {wtxid}");This is my test command: |
|
I think I've ironed out what is happening with this test. Because I don't allow for any buffer of time between the node starting and the attempting to send the transaction, Kyoto advertises the transaction sometime during the version handshake with the remote node. As a result the remote node just drops it on the floor. I will change this to broadcast after a short delay, and timeout with an error if the |
That’s exactly what I thought. If there were a way to determine the number of established connections before attempting a broadcast, it would have simplified the process. That is why in the initial implementation, I allowed a 60-second buffer before broadcasting, which made it a bit more reliable. |
|
There is |
6f98ece to
afd6e1b
Compare
|
I was able to successfully broadcast a transaction with the most recent commit. I changed the default connections to 2, as there are only a couple CBF nodes on testnet4 and signet |
afd6e1b to
8ac6957
Compare
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.
Even with the latest commit I was unable to broadcast a Tx. I did a little debugging and found that I get info_subscriber.len() = 0 right before the while let Some(info) = info_subscriber.recv().await { ... code is called which means it returns None and nothing is ever broadcast.
@rustaceanrob what OS are you using? I'm on MacOS (M1). Could it be some timing difference or way tokio is handling multiple threads? I also tried adding a sleep prior to the above line and it didn't make a difference.
|
It sounds like your node is returning an error when calling "run". I suggest removing the light_client_data directory. The only time I've gotten errors is 1. the light_client_data directory is in use by another program 2. the wallet is requesting a sync lower than the headers Kyoto is able to load from SQL |
|
You were right! I cleared the light_client_data directory and re-sync'd skipping the first 50K blocks and then I was able to broadcast. I probably ran into this because the wallet data and light_client_data were in different spots and I probably removed one and not the other during testing, #183 puts them under the same parent. I still think this could use some better error reports to see when issues like this come up, but that can come in future PRs. |
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.
ACK 8ac6957
Please just rebase and fix the build warning and typo and then I'll merge it. Or if you're busy let me know and I'll do it. Thanks!
For the highest reliability, we wait for the connection requirement to be met by the node. Once met, we can broadcast and wait for confirmation. The function will either timeout after 15 seconds or successfully finish with gossip confirmation.
4aeab92 to
d0513e9
Compare
d0513e9 to
811f614
Compare
notmandatory
left a comment
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.
ACK 811f614
The actual implementation comes down to listening for an info message that reports the transaction was sent to a peer. For simplicity I am ignoring any wallet updates, but if the user calls the
Synccommand they can catch them. Follows up #181Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
CHANGELOG.mdBugfixes: