aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-07-01 02:30:37 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-07-20 22:50:14 +0200
commit2ebf2fe0e4727a5a57a03f4283bdf1e263855803 (patch)
treebdf52b29f0795376cae1a32923a2746edf17240f /test
parent9faa4b68db80a4a5c1f5a4e0484d804d7b5e1493 (diff)
downloadbitcoin-2ebf2fe0e4727a5a57a03f4283bdf1e263855803.tar.xz
test: check for RPC error 'Transaction already in block chain' (-27)
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()