Page MenuHomePhabricator

[tests] Fix tx padding
ClosedPublic

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

Details

Summary

The padding goes after OP_RETURN

Test Plan

Test pad_raw_tx with and without -acceptnonstdtxn

Diff Detail

Repository
rABC Bitcoin ABC
Branch
qa-opreturn-fix
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4622
Build 7307: Bitcoin ABC Buildbot (legacy)
Build 7306: arc lint + arc unit

Event Timeline

#!/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]
        n.generate(101)

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

OpRet().main()

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

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