Author

Topic: mandatory-script-verify-flag-failed (Data push larger than necessary) (Read 103 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
Your scriptSig pushes the redeemScript with an OP_PUSHDATA1 for a script that is only 71 bytes. For scripts less than or equal to 75 bytes, you don's need to use OP_PUSHDATA opcodes, you can just encode their length directly (with some exceptions for single byte number pushes).

Your scriptSig should be:
Code:
00483045022100eb3ea1fab7bc2b62ace76c2fa1b6ca1089584c1ca1722b19473c884829de93be02206b45a992ca5684cdfd4c42843f798569056294c3269ceca6a1a8a5318beaddcc01473044022015b1723edeb58967632ffc8edb41af81335e91e29d15f745f5d57b52e1b4de5c02205a3a00efb6809fa4905a25f7c1192a7c59027cd34d39cb17df336f21913b421e014c4751210385a74bf00bf2cce53df9b747184ff17aa149d4aa3ec03fdb0af361f358667b162103fd0a98da9b6120f1d9b3cb0f285b89b8fd9a3886fae0db34da06c63bbbfac13752ae
jr. member
Activity: 46
Merit: 25


If it helps, here's the raw hex of the tx broken down into parts.

Array
(
   
  • => 02000000
  • [1] => 01
        [2] => 259337f4ff681337e4dfb996c9223be1cd1e1923fd90b5bbcca6adfd8e3580a5
        [3] => 01000000
        [4] => db
        [5] => 004830450221008c5e402ac60822fa9f328b5830eb10dc36c7576ae8288f258ff25c60e44d5d850 2206d741730d2175e6fef423d6969f76b934bbf77e5f40402dd884bc63f9a69d0ff014730440220 4f591d7f33ac0fe12cdaa3f292c84b92f660adf5dcc258dcbdd4e756c9a1463a02204a47b7050ed 1ddb7bdb1f9079c662bec5d9a618bfd6ae77492ba0d022188e2fb014c4751210385a74bf00bf2cc e53df9b747184ff17aa149d4aa3ec03fdb0af361f358667b162103fd0a98da9b6120f1d9b3cb0f2 85b89b8fd9a3886fae0db34da06c63bbbfac13752ae
        [6] => ffffffff
        [7] => 02
        [8] => e02e000000000000
        [9] => 19
        [10] => 76a914c52521573e6e423792dbf341abaa0d227108bcec88ac
        [11] => 7c7a040000000000
        [12] => 17
        [13] => a914daa80a6adf9ac5cb07e0ab1236ebcdc869651ef487
        [14] => 00000000
    )

    And the full hex:

    0200000001259337f4ff681337e4dfb996c9223be1cd1e1923fd90b5bbcca6adfd8e3580a501000 000db00483045022100eb3ea1fab7bc2b62ace76c2fa1b6ca1089584c1ca1722b19473c884829de 93be02206b45a992ca5684cdfd4c42843f798569056294c3269ceca6a1a8a5318beaddcc0147304 4022015b1723edeb58967632ffc8edb41af81335e91e29d15f745f5d57b52e1b4de5c02205a3a00 efb6809fa4905a25f7c1192a7c59027cd34d39cb17df336f21913b421e014c4751210385a74bf00 bf2cce53df9b747184ff17aa149d4aa3ec03fdb0af361f358667b162103fd0a98da9b6120f1d9b3 cb0f285b89b8fd9a3886fae0db34da06c63bbbfac13752aeffffffff02e02e0000000000001976a 914c52521573e6e423792dbf341abaa0d227108bcec88ac7c7a04000000000017a9146552b98864 0c9b922dcae94e17d81a972d2575da8700000000


jr. member
Activity: 46
Merit: 25

it's been a while since I worked with raw transactions, so unsure of what's changed or what I'm doing wrong.  Simply ported old code over to new infrastructure, and sure enough, getting that infamous error of, "mandatory-script-verify-flag-failed (Data push larger than necessary)" upon running "sendrawtransaction"

Was wondering if any kind soul could take a quick look at the below and see what I'm doing wrong?

Much appreciated,
Matt


    {
    "txid": "5992759a3811c6e083d05a4cf55a1b5af7046369c365f72d397376d003995441",
    "hash": "5992759a3811c6e083d05a4cf55a1b5af7046369c365f72d397376d003995441",
    "version": 2,
    "size": 337,
    "vsize": 337,
    "weight": 1348,
    "locktime": 0,
    "vin": [
        {
            "txid": "a580358efdada6ccbbb590fd23191ecde13b22c996b9dfe4371368fff4379325",
            "vout": 1,
            "scriptSig": {
                "asm": "0 3045022100fedbf159a233e9de39920e167c3469a83bfb45b243a58403c401fe1a8fe2f44d02201 98d3e087ae772c5a1f45a6d9144da047ddc24fdb9b05430d3e0ea84432c6d80[ALL] 3045022100ac9b523f77f86245c854ea05a1e180da9d97ea2274cf9344797d5560272d3c5602203 ebbd26f0a7b26cf3347dec73cfaf5ea9c66ecbff504c7a18d98cddb45958358[ALL] 51210385a74bf00bf2cce53df9b747184ff17aa149d4aa3ec03fdb0af361f358667b162103fd0a9 8da9b6120f1d9b3cb0f285b89b8fd9a3886fae0db34da06c63bbbfac13752ae",
                "hex": "00483045022100fedbf159a233e9de39920e167c3469a83bfb45b243a58403c401fe1a8fe2f44d0 220198d3e087ae772c5a1f45a6d9144da047ddc24fdb9b05430d3e0ea84432c6d80014830450221 00ac9b523f77f86245c854ea05a1e180da9d97ea2274cf9344797d5560272d3c5602203ebbd26f0 a7b26cf3347dec73cfaf5ea9c66ecbff504c7a18d98cddb45958358014c4751210385a74bf00bf2 cce53df9b747184ff17aa149d4aa3ec03fdb0af361f358667b162103fd0a98da9b6120f1d9b3cb0 f285b89b8fd9a3886fae0db34da06c63bbbfac13752ae"
            },
            "sequence": 4294967295
        }
    ],
    "vout": [
        {
            "value": 0.00012000,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 c52521573e6e423792dbf341abaa0d227108bcec OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914c52521573e6e423792dbf341abaa0d227108bcec88ac",
                "address": "myVMthUpdMj3p7ja195tsyUceKtVWphqzA",
                "type": "pubkeyhash"
            }
        },
        {
            "value": 0.00293500,
            "n": 1,
            "scriptPubKey": {
                "asm": "OP_HASH160 3eb8bac3bd280956be98c686f674552cc3638767 OP_EQUAL",
                "hex": "a9143eb8bac3bd280956be98c686f674552cc363876787",
                "address": "2MxxsBQpfJmi5CCE4Xe2kmeBgv2iz7a3j9K",
                "type": "scripthash"
            }
        }
    ]
    }

Jump to: