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
test: replace tx hash with txid in rawtransaction test #16078
Conversation
ACK a65dafa |
utACK a65dafa |
Please remove the legacy setting with the following diff: diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py
index 6a23891611..4338675270 100755
--- a/test/functional/rpc_rawtransaction.py
+++ b/test/functional/rpc_rawtransaction.py
@@ -42,7 +42,11 @@ class RawTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
- self.extra_args = [["-addresstype=legacy", "-txindex"], ["-addresstype=legacy", "-txindex"], ["-addresstype=legacy", "-txindex"]]
+ self.extra_args = [
+ ["-txindex"],
+ ["-txindex"],
+ ["-txindex"],
+ ]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
@@ -438,7 +442,7 @@ class RawTransactionsTest(BitcoinTestFramework):
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)
rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx)
assert_equal(rawTxSigned['complete'], True)
- # 1000 sat fee, ~200 b transaction, fee rate should land around 5 sat/b = 0.00005000 BTC/kB
+ # 1000 sat fee, ~100 b transaction, fee rate should land around 10 sat/b = 0.00010000 BTC/kB
# Thus, testmempoolaccept should reject
testres = self.nodes[2].testmempoolaccept([rawTxSigned['hex']], 0.00001000)[0]
assert_equal(testres['allowed'], False)
@@ -446,9 +450,9 @@ class RawTransactionsTest(BitcoinTestFramework):
# and sendrawtransaction should throw
assert_raises_rpc_error(-26, "absurdly-high-fee", self.nodes[2].sendrawtransaction, rawTxSigned['hex'], 0.00001000)
# And below calls should both succeed
- testres = self.nodes[2].testmempoolaccept(rawtxs=[rawTxSigned['hex']], maxfeerate='0.00007000')[0]
+ testres = self.nodes[2].testmempoolaccept(rawtxs=[rawTxSigned['hex']], maxfeerate='0.00070000')[0]
assert_equal(testres['allowed'], True)
- self.nodes[2].sendrawtransaction(hexstring=rawTxSigned['hex'], maxfeerate='0.00007000')
+ self.nodes[2].sendrawtransaction(hexstring=rawTxSigned['hex'], maxfeerate='0.00070000')
if __name__ == '__main__': |
Hash is the stronger of the two-- if hash is the same txid will be the same. Is weakening the test the correct change here? (I have no idea, I just don't see a justification). I am not suggesting that weakening the tests is bad: overly exact tests have greatly diminished value when their exactitude turns them into hyper-active "something changed" detectors when they would otherwise be more useful as "something isn't right" detectors if constructed more in terms of invariants instead of strict behaviour. As a plea to contributors: The code itself tells us what it does but it less often tells us why. The essential thing for commit messages and pull requests text to do is to tell us why. Of course, summarizing "what" can be good too. "Why" is also essential to review because if the why doesn't make sense the what probably doesn't matter. Sometimes things are really self apparent, but when in doubt no one was ever hurt by a little more explanation. |
@gmaxwell txid is correct here, as it's about arguments to the gettransansaction RPC. It just happens to work with non-witness transactions, as hash equals txid there. |
@sipa Thanks! Concept ACK |
ed46e91
to
294dd1b
Compare
I did it @MarcoFalke |
0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
Indeed, it would fail (after
|
…n test 0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
Summary: Comment by @sipa: > txid is correct here, as it's about arguments to the gettransansaction RPC. This is a partial backport of Core [[bitcoin/bitcoin#16078 | PR16078]] Commit bitcoin/bitcoin@a65dafa The next commit is not needed as its changes are overwritten in D8027 / PR16251 See D1556 for why we have additional lines changed. Test Plan: `ninja && ninja && test/functional/test_runner.py rpc_rawtransaction.py` Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8050
…n test 0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
…n test 0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
…n test 0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
…n test 0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
…n test 0784af1 remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007) a65dafa replace tx hash with txid in test rawtransaction (LongShao007) Pull request description: The transaction hash is different from txid for witness transactions, so we should use txid instead of hash. ACKs for commit 0784af: Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
The transaction hash is different from txid for witness transactions, so we should use txid instead of hash.