-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Restore test case for p2p transaction blinding #19649
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
Conversation
f2da6bf to
0fea6ed
Compare
|
ACK 0fea6ed However, while we're at it, maybe also check that announcing the stuffed tx3 via wtxid does blind the node to the wtxid? I don't think --- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -174,6 +174,9 @@ class TestP2PConn(P2PInterface):
self.last_wtxidrelay.append(message)
def announce_tx_and_wait_for_getdata(self, tx, timeout=60, success=True, use_wtxid=False):
+ if success:
+ # sanity check
+ assert (self.wtxidrelay and use_wtxid) or (not self.wtxidrelay and not use_wtxid)
with mininode_lock:
self.last_message.pop("getdata", None)
if use_wtxid:
@@ -259,6 +262,8 @@ class SegWitTest(BitcoinTestFramework):
self.old_node = self.nodes[0].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK)
# self.std_node is for testing node1 (fRequireStandard=true)
self.std_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK | NODE_WITNESS)
+ # self.std_wtx_node is for testing node1 with wtxid relay
+ self.std_wtx_node = self.nodes[1].add_p2p_connection(TestP2PConn(wtxidrelay=True), services=NODE_NETWORK | NODE_WITNESS)
assert self.test_node.nServices & NODE_WITNESS != 0
@@ -1320,10 +1325,13 @@ class SegWitTest(BitcoinTestFramework):
tx3.rehash()
# Node will not be blinded to the transaction, requesting it any number of times
- # since it is being announced via txid relay.
+ # if it is being announced via txid relay.
+ # Node will be blinded to the transaction via wtxid, however.
self.std_node.announce_tx_and_wait_for_getdata(tx3)
+ self.std_wtx_node.announce_tx_and_wait_for_getdata(tx3, use_wtxid=True)
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, True, False, 'tx-size')
self.std_node.announce_tx_and_wait_for_getdata(tx3)
+ self.std_wtx_node.announce_tx_and_wait_for_getdata(tx3, use_wtxid=True, success=False)
# Remove witness stuffing, instead add extra witness push on stack
tx3.vout[0] = CTxOut(tx2.vout[0].nValue - 1000, CScript([OP_TRUE, OP_DROP] * 15 + [OP_TRUE])) |
h/t Anthony Towns
|
@ajtowns looks good, may as well get this in now, confirmed it's not already(intentionally) tested for |
|
@sdaftuar you may be interested |
|
Concept ACK, thanks for paying attention here. |
|
tACK 566aada |
566aada Test that wtxid relay peers add wtxid to reject filter (Gregory Sanders) 0fea6ed Restore test case for p2p transaction blinding (Gregory Sanders) Pull request description: Introduced in ca10a03 then erroneously removed in 8d8099e. The restored line is how we are checking that the node will still re-request a specific txid given a witness-related failure. ACKs for top commit: fjahr: tACK 566aada Tree-SHA512: be2b75b5eddb88019b79cc798f9922ca7347ccbb2210b8d4eae93fdde62e2cbb614b5247cb2fbd7ee3577dbe053875a9b62c5747aace8617f12790b8fccdeab4
| self.std_wtx_node.announce_tx_and_wait_for_getdata(tx3, use_wtxid=True) | ||
| test_transaction_acceptance(self.nodes[1], self.std_node, tx3, True, False, 'tx-size') | ||
| self.std_node.announce_tx_and_wait_for_getdata(tx3) | ||
| self.std_wtx_node.announce_tx_and_wait_for_getdata(tx3, use_wtxid=True, success=False) |
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.
This results in a sleep(60) since the timeout defaults to 60. We don't need to wait that long to verify that the inv doesn't result in a getdata.
Fixed in #21804
Introduced in ca10a03 then erroneously removed in 8d8099e. The restored line is how we are
checking that the node will still re-request a specific txid given a witness-related failure.