Can there be more than one result of decoding a raw transaction? I was looking in rpcrawtransaction.cpp and came across the signrawtransaction rpc method. While reading through this method, I thought these lines seemed strange:


    vector&lt;CTransaction> txVariants;
    while (!ssData.empty())
    {
        try {
            CTransaction tx;
            ssData >> tx;
            txVariants.push_back(tx);
        }
        catch (std::exception &e) {
            throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
        }
    }


Why is a vector of transaction variants needed here? Could decoding a raw transaction ever have more than one solution? 

Maybe this has something to do with unfinished transactions, specifically? 

I noticed that sendrawtransaction doesn't have the same loop, but rather just has:


    CTransaction tx;

    // deserialize binary data stream
    try {
        ssData >> tx;
    }
    catch (std::exception &e) {
        throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
    }


The below seems relevant, too. It happens near the end of signrawtransaction. 


    // ... and merge in other signatures:
    BOOST_FOREACH(const CTransaction& txv, txVariants)
    {
        txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
    }


Maybe this has something to do with multisig?
Could decoding a raw transaction ever have more than one solution?


Decoding raw transaction is just a human-readable representation of transaction data. So, the answer is "no" and "yes"

There is only one decoding for transaction.

But another client/version may add some other fields for json