Receiving `error: {"code":-25,"message":""}` on sendrawtransaction with v0.9.3

3

I'm running a bitcoind regtest node. When trying to relay a transaction (created using bitcoin-ruby) I receive
error: {"code":-25,"message":""} When I restart the node and relay the exact same transaction it relays fine. This behavior is consistent and reproduces every time.

My output for decoderawtransaction is:

{
    "txid" : "df91267ed650795245882bc91b8dc104e6c41d2f29ed3221f29151aa60554842",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "fab40dbf6b95ef2fe5f4aca0668a84edebdf70cfb80565626be80c7af20a525e",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "0 3046022100fb2a69546ea44db3a06cfcf120d1fda135bfde0946f2186a52d8cfee83835705022100c680cc5135174425ce5137a2996fbdcd55463c4acb88bb9fdbdb03f70f0a213b01 30460221008294d1779bfb21240859feccc96104dea574541d41163d2c849846d8e44496fe022100faf00dabba65f22469a1116ea10d5ce34f90bea779ba770ae1ac3af5c432379e01 52210261318d096a7addf67d935076c28dfa4a1c0e8f2ed04a7cb47ac53bd7fe2ebe6d210397866513a1796e75aae6a53d54d0ccc904c56fa12e14ab0ee989a6eed6e29c0352ae",
                "hex" : "00493046022100fb2a69546ea44db3a06cfcf120d1fda135bfde0946f2186a52d8cfee83835705022100c680cc5135174425ce5137a2996fbdcd55463c4acb88bb9fdbdb03f70f0a213b014930460221008294d1779bfb21240859feccc96104dea574541d41163d2c849846d8e44496fe022100faf00dabba65f22469a1116ea10d5ce34f90bea779ba770ae1ac3af5c432379e014c4752210261318d096a7addf67d935076c28dfa4a1c0e8f2ed04a7cb47ac53bd7fe2ebe6d210397866513a1796e75aae6a53d54d0ccc904c56fa12e14ab0ee989a6eed6e29c0352ae"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 1.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 ee7455fa97980531b90b15f5f18386122a7f6919 OP_EQUAL",
                "hex" : "a914ee7455fa97980531b90b15f5f18386122a7f691987",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "2NEz4B6YtgTCpv6Qv56f7HarXUeHeLmdmih"
                ]
            }
        },
        {
            "value" : 0.99990000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 0b607311f3db7d2a28b4c6fd259913356a86c302 OP_EQUAL",
                "hex" : "a9140b607311f3db7d2a28b4c6fd259913356a86c30287",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "2MtHNxpeYfFmLTMDnW7DFf9y9ZnM49u4tXW"
                ]
            }
        }
    ]
}

The referenced txout has 2 BTC. I also tried sendrawtransaction <hex>, true to try and rule out some fee problems. Same symptom. I didn't see any special debug message in debug.log

My output for getinfo is:

{
    "version" : 90300,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 530.90534322,
    "blocks" : 460,
    "timeoffset" : 0,
    "connections" : 1,
    "proxy" : "",
    "difficulty" : 0.00000000,
    "testnet" : false,
    "keypoololdest" : 1421187525,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""
}

I'm still trying to plug v0.10 into my environment for debugging, I understand bitcoin-core has better messages for code -25, but I still need this to play nice with a v0.9 node.

Shaul Kfir

Posted 2015-01-13T23:33:01.923

Reputation: 151

1Thanks, I already took a look at this. I tried mining before the relay, to flush the mempool but the same thing happens, error unless I restart the node after which it works (this rules out double spend)Shaul Kfir 2015-01-14T00:05:20.560

Mining the memory pool doesn't rule out double spend: if there was a conflicting tx in the memory pool, mining it puts that conflicting tx on the block chain---so your transaction is still a conflict. Can you use getrawmempool to verify there isn't a conflicting tx in the mempool and getblock to verify there isn't a conflicting tx in the blocks you mined? Also, gettxout to ensure the input you're trying to spend exists.

David A. Harding 2015-01-14T00:17:35.297

Thanks @David, I checked getrawmempool and getblock for conflicting tx and found none. I agree mining doesn't rule out double spend, but being able to relay the tx and mine it after mining a block and a node restart does. When I do gettxout I get strange behavior. I constructed the tx to use input 1 of a tx. I see a txout for gettxout &lt;hash&gt; 0 true but not for gettxout &lt;hash&gt; 1 true. When I restart bitcoind I see both outpoints 0 and 1.Shaul Kfir 2015-01-14T13:55:23.223

Also, this only happens with bitcoind, if I relay through a non-bitcoind node connected to my bitcoind node, it relays just fine and gets included in block.Shaul Kfir 2015-01-14T14:40:37.300

Besides testing with 0.10.0 and maybe also regular testnet, I can't think of anything else for you to try. If you can reproduce the problem on 0.10.0, it may be time to report the issue.

David A. Harding 2015-01-14T15:37:13.373

Answers

2

After connecting to bitcoin-core (0.10.0rc3) I received:

ERROR: CScriptCheck() : 620186f101b7db97393af8747923db4cf3f30c3c3c48f4c7cfc23567b6d9ca07:0 VerifySignature failed: Data push larger than necessary
ERROR: AcceptToMemoryPool: : ConnectInputs failed 620186f101b7db97393af8747923db4cf3f30c3c3c48f4c7cfc23567b6d9ca07

(Thanks bitcoin devs for adding sane error messages!)

From here I noticed I was building the transaction with an outdated fork of bitcoin-ruby, updating to the latest bitcoin-ruby fixed this issue (On both 0.9.03 and 0.10.0). Still not sure why it would only relay after a bitcoind restart, will edit this answer if I figure this out.

Shaul Kfir

Posted 2015-01-13T23:33:01.923

Reputation: 151