Skip to content

Commit 2ebf2fe

Browse files
committed
test: check for RPC error 'Transaction already in block chain' (-27)
1 parent 9faa4b6 commit 2ebf2fe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,15 @@ def run_test(self):
515515
assert_equal(testres['allowed'], True)
516516
self.nodes[2].sendrawtransaction(hexstring=rawTxSigned['hex'], maxfeerate='0.20000000')
517517

518+
self.log.info('sendrawtransaction/testmempoolaccept with tx that is already in the chain')
519+
self.nodes[2].generate(1)
520+
self.sync_blocks()
521+
for node in self.nodes:
522+
testres = node.testmempoolaccept([rawTxSigned['hex']])[0]
523+
assert_equal(testres['allowed'], False)
524+
assert_equal(testres['reject-reason'], 'txn-already-known')
525+
assert_raises_rpc_error(-27, 'Transaction already in block chain', node.sendrawtransaction, rawTxSigned['hex'])
526+
518527

519528
if __name__ == '__main__':
520529
RawTransactionsTest().main()

0 commit comments

Comments
 (0)