Page MenuHomePhabricator

[tests] Fix tx padding

Authored by dagurval on Jan 21 2019, 21:02.



The padding goes after OP_RETURN

Test Plan

Test pad_raw_tx with and without -acceptnonstdtxn

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dagurval created this revision.Jan 21 2019, 21:02
Herald added a reviewer: Restricted Project. · View Herald TranscriptJan 21 2019, 21:02
Herald added a subscriber: schancel. · View Herald Transcript
#!/usr/bin/env python3

from test_framework.test_framework import BitcoinTestFramework
from test_framework.txtools import pad_raw_tx

class OpRet(BitcoinTestFramework):

    def set_test_params(self):
        self.num_nodes = 1
        self.extra_args = [["-acceptnonstdtxn=0"]]

    def run_test(self):
        n = self.nodes[0]
        txid_in = n.getblock(n.generate(1)[0])['tx'][0]

        rawtx = n.createrawtransaction([{
            'txid' : txid_in, 'vout' : 0}],
            { n.getnewaddress() : 1 })
        rawtx = n.signrawtransaction(pad_raw_tx(rawtx))['hex']
        n.sendrawtransaction(rawtx, True)


Thus script will fail on test_framework.authproxy.JSONRPCException: 64: scriptpubkey (-26) without this fix.

deadalnix accepted this revision.Jan 21 2019, 23:33
This revision is now accepted and ready to land.Jan 21 2019, 23:33
jasonbcox accepted this revision.Jan 22 2019, 01:02
This revision was automatically updated to reflect the committed changes.