Maybe we should precise unbroadcast set semantic wrt same txid, different wtxids, we only guarantee reattempt to the best mempool candidate known for a given txid at the time we call ReattemptInitialBroadcast, not insertion (AddUnbroadcastTx). # (comment) isn't an issue. BitAccelerate is a free Bitcoin transaction accelerator that allows you to get faster confirmations on your unconfirmed transactions. Just enter the transaction ID (TXID) and click the "Accelerate" button. Our service will rebroadcast the transaction via 10 Bitcoin nodes. getrawtransaction¶. getrawtransaction "txid" (verbose "blockhash"). Return the raw transaction data. By default this function only works for mempool transactions. When called with a blockhash argument, getrawtransaction will return the transaction if the specified block is .
Bitcoin same txidgetrawtransaction — Bitcoin
We have a bloom filter of recently rejected transactions, whose purpose is to help us avoid redownloading and revalidating transactions that fail to be accepted, but because of this potential for witness malleability to interfere with relay of valid transactions, we do not use the filter for segwit transactions.
This issue is discussed at some length in The effect of this is that whenever a segwit transaction that fails policy checks is relayed, a node would download that transaction from every peer announcing it, because it has no way presently to cache failure. As discussed in that issue, switching to wtxid-based relay solves this problem -- by using an identifier for a transaction that commits to all the data in our relay protocol, we can be certain if a transaction that a peer is announcing is one that we've already tried to process, or if it's something new.
This PR introduces support for wtxid-based relay with peers that support it and remains backwards compatible with peers that use txids for relay, of course. Apart from code correctness, one issue to be aware of is that by downloading from old and new peers alike, we should expect there to be some bandwidth wasted, because sometimes we might download the same transaction via txid-relay as well as wtxid-relay.
The last commit in this PR implements a heuristic I want to analyze, which is to just delay relay from txid-relay peers by 2 seconds, if we have at least 1 wtxid-based peer. I've just started running a couple nodes with this heuristic so I can measure how well it works, but I'm open to other ideas for minimizing that issue. In the long run, I think this will be essentially a non-issue, so I don't think it's too big a concern, we just need to bite the bullet and deal with it during upgrade.
Finally, this proposal would need a simple BIP describing the changes, which I haven't yet drafted. However, review and testing of this code in the interim would be welcome. The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. If you consider this pull request important, please also help to review the conflicting pull requests.
Ideally, start with the one that should be merged first. Currently reviewing. Can someone add a Review club label? It helps let people know that there is a review club resource they can use.
Cocnept ACK. Ran standard tests. All passing. Overall agreed with the idea of using wtxid for everything. Will try to try out the huristic and report some results. Doesn't this comment needs update in light of the changed condition? We are now accepting txs containg witness in recentRejects. Concept ACK. Didn't-get-a-chance-to-go-through-the-whole-thing-and-am-too-tired-to-be-reviewing-anyway Concept ACK. I don't think the extra characters to write a useful name cost us much :p.
The suffix here represents an object being fetched. Maybe I've been staring at this for too long but I agree with naumenkogs. I think it's fine for now. Wouldn't that allow an attacker to see an 0. From a single node's perspective, as long as you have at least 1 honest wtxid-relay peer, such an attack would not work, because the wtxid for the honest version of the transaction would not be added to your filter only the txid , and so you would eventually request the valid version of the transaction from your honest wtxid-relay peer.
Currently we preference outbound peers for transaction download, so once we believe that some sufficient majority of listening nodes support wtxid-relay, such that the chances of having 0 or just a few wtxid-relay-outbound-peers is pretty small, then I think we can just get rid of this. I don't think our threat model has ever really been too concerned with every node getting every transaction, anyway -- we just don't want the network as a whole to not relay a transaction altogether because of something like this.
So exactly how long we should wait before dropping this logic is debatable IMO; anyway we should defer the debate to the future when someone thinks this is ready. FWIW, travis error is " node0 T I am not so sure about the 2-second delay, however, because it is not necessarily an improvement, it can also make matters worse afaict.
Example: At least one of our txid peers is better connected than all of our wtxid peers. We get a txid inv first and wait for 2 seconds. Meanwhile, we receive the wtxid inv and request it, but before we get the response we also request the transaction from the txid peer.
I am not sure how realistic this is and it will certainly not happen frequently once large parts of the network have upgraded to wtxid invs. But I also think the PR is compelling enough without the 2-second delay optimization and it could be left as a follow-up so it can be discussed separately. JeremyRubin I think that's hard, because a portion of the code relies on the fact that the wtxid of a non-witness tx is also its txid.
I don't think this change is necessary or desirable. My mistake here, effectively you need to announce transactions from the unbroadcast set by wtxid to upgraded peers but as you point out it doesn't mean we need to cache them as a solution. Maybe we should precise unbroadcast set semantic wrt same txid, different wtxids, we only guarantee reattempt to the best mempool candidate known for a given txid at the time we call ReattemptInitialBroadcast , not insertion AddUnbroadcastTx.
I really think this "same txid, different wtxid" thing is a complete red herring. The mempool can only ever be aware of one witness for a transaction, so any attempt to announce the transaction via a different wtxid would fail anyway. As Suhas pointed out earlier comment , to support tracking multiple witnesses we'd need to make significant changes many of our components. Besides, the unbroadcast set is transactions that we created ourselves, so we're not expecting the witnesses to change.
Agree with jnewbery. There is no real way that we can reasonable start tracking multiple witnesses for the same transaction either in the mempool or the wallet, I thought during implementation I ran into something that prevented me from exclusively having txids on the set, but that evaluation is simply wrong.
I've taken a first pass at reverting unbroadcast to a set here: amitiuttarwar f51cccd. I'll need to revisit with fresh eyes and then will PR. I agree set makes more sense than a map- its simpler, communicates the intent better, and there's no noticeable efficiency gain with the map.
Since we check the transaction is the mempool, the difference between map vs set is the difference between calling CTxMemPool::get vs CTxMemPool::exists. This boils down to mapTx. I'll review fully once you open a PR. We shouldn't be indiscriminately taking the address of a return value which may be nullptr. I know the same pattern exists in a few other places, but really we should check for existence here before dereferencing the pointer.
The else if tx. Post merge review up to ac88e2e. Clarification: does moving this out of the try block have any behavior change? Continuing anyway. Yes I believe so? Fortunately for std::map we deserialize an element and then insert it into the map, but is a possibility that we say that there should be 10 elements and there are only 5 elements, or there are 5 elements and their are actually In the event the file is corrupt, we should likely treat it as if the entire thing is corrupt, rather than continuing to process.
Perhaps we should add an exception to throw from Unserialize if there are not the correct amount of entries? I'm not sure to the degree we need to worry about files on our own local being corrupt, and there are other forms of corruption that can occur.
But because it is a behavior change, I'm noting it. Is this correct? Should this transaction get queued somewhere for rebroadcasting? Or is it a known precondition that because it failed to get into the mempool before this line it will fail again? I can't think of why we'd want it in the unbroadcast if it didn't make it back in the mempool, but just double checking.
What changed to cause it to no longer be accepted? This is a small performance win avoiding an extra iterator lookup. Skip to content. New issue. Jump to bottom. Use wtxid for transaction relay laanwj merged 18 commits into bitcoin : master from sdaftuar : wtxid-inv Jul 22, Conversation Commits 18 Checks 2 Files changed.
Copy link Quote reply. To do items: Write BIP explaining the spec here 1 new p2p message for negotiating wtxid-based relay, along with a new INV type Measure and evaluate a heuristic for minimizing how often a node downloads the same transaction twice, when connected to old and new nodes. Copy link. Conflicts Reviewers, this pull request conflicts with the following ones: Remove mempool global by MarcoFalke Tidy up ProcessOrphanTx by jnewbery Refactor mempool. TomMD mentioned this pull request Jan 31, Here are the transactions and the blocks they were included in:.
Later, BIP 34 required coinbase transactions to include the height of the block the were mining in to their transaction data, so that coinbase transactions could be different. Thanks to DJBunnies for pointing this out to me. I'll let you know about cool website updates , or if something seriously interesting happens in bitcoin. Don't worry, it doesn't happen very often. Examples: ffcb9dcf57adfe4c75cffbcee9e16 - First ever Bitcoin transaction to Hal Finney in Searching for TXIDs in the blockchain.
Because welcome to Bitcoin. Coinbase transactions having the same TXID. Here are the transactions and the blocks they were included in: e3bf3d07d4bd5f1dbfe07ba2c4cbcd81b84eebfb block 91, a2dc26eff2edce5a6c6cdf3fdd08e block 91, fa18ca3c2d2a1faeacaccb7cd d5dd2a3dfcecb40ebdcafed block 91, af0aedb1acee3daf36cf5defdb8de83d6ff2f block 91, a4d0affccb1fe0e4c8ee0caec The Fix.