aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-07-21 11:10:25 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-07-21 11:10:58 +0200
commit40fed336b2aeb6f4e698cac7584a2fe916e20608 (patch)
tree75b4c0392fc0b185139302780d2ac25f525d0ea3 /test
parenta273e3c58af1d95ecfc5f257ec59c1242f5b2570 (diff)
parent2ebf2fe0e4727a5a57a03f4283bdf1e263855803 (diff)
Merge bitcoin/bitcoin#22510: test: add test for RPC error 'Transaction already in block chain'
2ebf2fe0e4727a5a57a03f4283bdf1e263855803 test: check for RPC error 'Transaction already in block chain' (-27) (Sebastian Falbesoner) Pull request description: This PR adds missing test coverage for the RPC error "Transaction already in block chain" (error code `RPC_VERIFY_ALREADY_IN_CHAIN` = `RPC_TRANSACTION_ALREADY_IN_CHAIN` = -27), which is thrown in the function `BroadcastTransaction` (src/node/transaction.cpp). ACKs for top commit: kristapsk: ACK 2ebf2fe0e4727a5a57a03f4283bdf1e263855803 (ran linter, looked at changes and ran modified test and checked code in `src/node/transaction.cpp`) darosior: ACK 2ebf2fe0e4727a5a57a03f4283bdf1e263855803 Tree-SHA512: 8bfbd3ff3da0cb3b8745f69b8ca2377f85fa99f0270750840b60e6ae43b5645c5c59b236993e8b2ad0444ec4171484e4f1ee23fa7e81b79d4222bcb623666fa5
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_rawtransaction.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py
index 3ff74dc5a4..9d4a5525d1 100755
--- a/test/functional/rpc_rawtransaction.py
+++ b/test/functional/rpc_rawtransaction.py
@@ -515,6 +515,15 @@ class RawTransactionsTest(BitcoinTestFramework):
assert_equal(testres['allowed'], True)
self.nodes[2].sendrawtransaction(hexstring=rawTxSigned['hex'], maxfeerate='0.20000000')
+ self.log.info('sendrawtransaction/testmempoolaccept with tx that is already in the chain')
+ self.nodes[2].generate(1)
+ self.sync_blocks()
+ for node in self.nodes:
+ testres = node.testmempoolaccept([rawTxSigned['hex']])[0]
+ assert_equal(testres['allowed'], False)
+ assert_equal(testres['reject-reason'], 'txn-already-known')
+ assert_raises_rpc_error(-27, 'Transaction already in block chain', node.sendrawtransaction, rawTxSigned['hex'])
+
if __name__ == '__main__':
RawTransactionsTest().main()