Skip to content

Fix broadcasting to a peer who already has tx#556

Open
randomlogin wants to merge 1 commit into2140-dev:masterfrom
randomlogin:tx-broadcast-fix
Open

Fix broadcasting to a peer who already has tx#556
randomlogin wants to merge 1 commit into2140-dev:masterfrom
randomlogin:tx-broadcast-fix

Conversation

@randomlogin
Copy link
Contributor

Previously if we broadcast to a peer who already has the tx it would hang indefinetely, as there is no subsequent getdata message.

@rustaceanrob
Copy link
Collaborator

This is by design. There is a possibility the first peer simply drops the inv announcement the first time we attempt to broadcast a transaction. It's the client responsibility to determine if they have already broadcast a transaction, they still want to try rebroadcasting, and to add timeouts accordingly. It would make sense to add a Builder method or direct argument on broadcast_tx to timeout.

@randomlogin
Copy link
Contributor Author

It's the client responsibility to determine if they have already broadcast a transaction

What if we ask the same peer for the tx we've just broadcast? Of course, it doesn't mean it has propagated further, but we know that the broadcast succeeded?

And also to have a fallback with timeout?

@randomlogin
Copy link
Contributor Author

randomlogin commented Mar 18, 2026

Is there a deep purpose of broadcast_tx only erring if the node stops?
Can adding a timeout error break some guarantees? It seems not, as it could just hang.

@randomlogin
Copy link
Contributor Author

I should not have squashed commits in this PR yet.

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.

2 participants