diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-11-05 15:10:08 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-11-05 15:10:27 +0100 |
commit | a339289c2ef9caffa1195436695a13f6e48e1bbc (patch) | |
tree | 2c9ac27ba4dee05366d415d81bedd932753c54ec /test/functional/wallet_resendwallettransactions.py | |
parent | b9ac31f2d29ae3e79c0f0cde5bab2d7213e6da51 (diff) | |
parent | d4a1ee8f1d4c46ab726be83965bd86bace2ec1ec (diff) | |
download | bitcoin-a339289c2ef9caffa1195436695a13f6e48e1bbc.tar.xz |
Merge #19606: Backport wtxid relay to v0.20
d4a1ee8f1d4c46ab726be83965bd86bace2ec1ec Further improve comments around recentRejects (Suhas Daftuar)
f082a13ab756a378b260711a30d363f833a2306a Disconnect peers sending wtxidrelay message after VERACK (Suhas Daftuar)
22effa51a77a8b8c72ba3525cb08dd0cf8464715 test: Use wtxid relay generally in functional tests (Fabian Jahr)
e4816819630d1e94469ca5499361e0cd2c9ac7c2 test: Add tests for wtxid tx relay in segwit test (Fabian Jahr)
6be398b6fb7a7d5c6c1fe6d74a0700b7ff93674e test: Update test framework p2p protocol version to 70016 (Fabian Jahr)
e364b2a2d879e8d30ca9dbc578e4d169b41eb227 Rename AddInventoryKnown() to AddKnownTx() (Suhas Daftuar)
879a3cf2c2367d51310204d21030f3b218582c30 Make TX_WITNESS_STRIPPED its own rejection reason (Suhas Daftuar)
c1d6a1003d601ec4ff7d9507563254b29868182f Delay getdata requests from peers using txid-based relay (Suhas Daftuar)
181ffadd162a84551b3518de77b5dcc08c712425 Add p2p message "wtxidrelay" (Suhas Daftuar)
93826726e76730b061ec4c91d69b2b34ebf98ec9 ignore non-wtxidrelay compliant invs (Anthony Towns)
2599277e9cb51e3619582978cba9bf03325c0cb6 Add support for tx-relay via wtxid (Suhas Daftuar)
be1b7a8916fdd060db56846ad5dcec0894aae314 Add wtxids to recentRejects (Suhas Daftuar)
73845211d16ad1558d84c966ae18e3507fa7dea6 Add wtxids of confirmed transactions to bloom filter (Suhas Daftuar)
606755b840b1560e4f92c9252fa4cab6eacabdd3 Add wtxid-index to orphan map (Suhas Daftuar)
36549376740d28159a5834ecf4ed9eeeeef6715d Add a wtxid-index to mapRelay (Suhas Daftuar)
f7833b5bd894aca2d8820402f4a500d71374ea0e Just pass a hash to AddInventoryKnown (Suhas Daftuar)
4df3d139b7261de33c070691f76a535b8b17433a Add a wtxid-index to the mempool (Suhas Daftuar)
Pull request description:
We want wtxid relay to be widely deployed before taproot activation, so it should be backported to v0.20.
The main difference from #18044 is removing the changes to the unbroadcast set (which was only added post-v0.20). The rest is mostly minor rebase conflicts (eg connman changed from a pointer to a reference in master, etc).
We'll also want to backport #19569 after that's merged.
ACKs for top commit:
fjahr:
re-ACK d4a1ee8f1d4c46ab726be83965bd86bace2ec1ec
instagibbs:
reACK https://github.com/bitcoin/bitcoin/pull/19606/commits/d4a1ee8f1d4c46ab726be83965bd86bace2ec1ec
laanwj:
re-ACK d4a1ee8f1d4c46ab726be83965bd86bace2ec1ec
hebasto:
re-ACK d4a1ee8f1d4c46ab726be83965bd86bace2ec1ec, only rebased since my [previous](https://github.com/bitcoin/bitcoin/pull/19606#pullrequestreview-492763028) review:
Tree-SHA512: 1bb8725dd2313a9a03cacf8fb7317986eed3d8d1648fa627528441256c37c793bb0fae6c8c139d05ac45d0c7a86265792834e8e09cbf45286426ca6544c10cd5
Diffstat (limited to 'test/functional/wallet_resendwallettransactions.py')
-rwxr-xr-x | test/functional/wallet_resendwallettransactions.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py index d122e3db52..fe670ddaee 100755 --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -7,7 +7,11 @@ from collections import defaultdict import time from test_framework.blocktools import create_block, create_coinbase -from test_framework.messages import ToHex +from test_framework.messages import ( + MSG_TX, + MSG_WTX, + ToHex, +) from test_framework.mininode import P2PInterface, mininode_lock from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, wait_until @@ -21,7 +25,7 @@ class P2PStoreTxInvs(P2PInterface): def on_inv(self, message): # Store how many times invs have been received for each tx. for i in message.inv: - if i.type == 1: + if i.type == MSG_TX or i.type == MSG_WTX: # save txid self.tx_invs_received[i.hash] += 1 @@ -39,7 +43,8 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): node.add_p2p_connection(P2PStoreTxInvs()) self.log.info("Create a new transaction and wait until it's broadcast") - txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16) + txid = node.sendtoaddress(node.getnewaddress(), 1) + wtxid = int(node.getrawtransaction(txid, 1)['hash'], 16) # Wallet rebroadcast is first scheduled 1 sec after startup (see # nNextResend in ResendWalletTransactions()). Sleep for just over a @@ -48,7 +53,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): time.sleep(1.1) # Can take a few seconds due to transaction trickling - wait_until(lambda: node.p2p.tx_invs_received[txid] >= 1, lock=mininode_lock) + wait_until(lambda: node.p2p.tx_invs_received[wtxid] >= 1, lock=mininode_lock) # Add a second peer since txs aren't rebroadcast to the same peer (see filterInventoryKnown) node.add_p2p_connection(P2PStoreTxInvs()) @@ -67,13 +72,13 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): # Transaction should not be rebroadcast node.syncwithvalidationinterfacequeue() node.p2ps[1].sync_with_ping() - assert_equal(node.p2ps[1].tx_invs_received[txid], 0) + assert_equal(node.p2ps[1].tx_invs_received[wtxid], 0) self.log.info("Transaction should be rebroadcast after 30 minutes") # Use mocktime and give an extra 5 minutes to be sure. rebroadcast_time = int(time.time()) + 41 * 60 node.setmocktime(rebroadcast_time) - wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock) + wait_until(lambda: node.p2ps[1].tx_invs_received[wtxid] >= 1, lock=mininode_lock) if __name__ == '__main__': |