user113736: When I transferred a 0.001 BTC from miBEA6o6nZcaLZebR1dsDv4AMHRwJk1mbi to miV1sbmLM9fptRfWD5o8hs5L6ucUeJzmp5, the following error occurred: mandatory-script-verify-flag-failed (Signature is found in scriptCode) (code 16).
This is my broadcast data:
01000000020e920885bc349b3ef0fcecb0acc04c74c59bdfc67d76242fc934f7f9d7d5c915010000006b483045022100dc4681014ce850d2808c82978d92b94f4940ef5ef9c63e3c9f248a0cdf9266df02203cf0344dfbe933d5335ab06da1040cf373d866efe156824e9938ba633bd54591012103a5be350852bb09e24edc83f8e02070a74597a8b775af46e8efbef394ae4fa98effffffff33c8ba1adb1b885e553610e9431bbdbfe14078a1de8ef60d9e29316ea759e8df010000006b483045022100a4cb81427b8613276d458df994d1c9b02aad66fa69be5aef10e71a392a9df10402205b8b919147543aa6c11b12b8b2c44edf498973c6539021cb349ecff674df3f93012103a5be350852bb09e24edc83f8e02070a74597a8b775af46e8efbef394ae4fa98effffffff02a0860100000000001976a914208a8852a3cec93382c8bebbbd6c9ef4676f512088ac8041100000000000232103a5be350852bb09e24edc83f8e02070a74597a8b775af46e8efbef394ae4fa98eac00000000`

The test method I performed: https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/test/java/live/lingting/virtual/currency/omni/Transfer.java#L130
Transfer operation, signed code: https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/main/java/live/lingting/virtual/currency/service/impl/BtcOmniServiceImpl.java#L248
The signature is at: https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/main/java/live/lingting/virtual/currency/service/impl/BtcOmniServiceImpl.java#L335
Signature code:
        List<TransactionInput> inputs = tx.getInputs();
     
    for (int i = 0; i < inputs.size(); i++) {
        Script script = ScriptBuilder.createOutputScript(fromAddress);
        TransactionInput txIn = tx.getInput(i);

        Sha256Hash hash = tx.hashForSignature(i, script, SigHash.ALL, false);
        ECKey.ECDSASignature ecdsaSignature = key.sign(hash);
        TransactionSignature txSignature = new TransactionSignature(ecdsaSignature, SigHash.ALL, false);
        if (ScriptPattern.isP2PK(script)) {
            txIn.setScriptSig(ScriptBuilder.createInputScript(txSignature));
        }
        else if (ScriptPattern.isP2SH(script)) {
            txIn.setScriptSig(ScriptBuilder.createP2SHMultiSigInputScript(ListUtil.toList(txSignature), script));
        }
        else if (ScriptPattern.isP2PKH(script)) {
            txIn.setScriptSig(ScriptBuilder.createInputScript(txSignature, key));
        }
        else if (ScriptPattern.isP2WPKH(script)) {
            Script scriptCode = ScriptBuilder.createP2PKHOutputScript(key);
            TransactionSignature signature = tx.calculateWitnessSignature(i, key, scriptCode, txIn.getValue(),
                    SigHash.ALL, false);
            txIn.setScriptSig(ScriptBuilder.createEmpty());
            txIn.setWitness(TransactionWitness.redeemP2WPKH(signature, key));
        }
        else {
            throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR,
                    "Unable to sign this scriptPubKey: " + script);
        }
    }

I would like to ask what is wrong with my code. In my submission this time https://github.com/lingting/VirtualCurrency/commit/0ea9b090d6fe2e4821afc10b5725436d56f2909d#diff-25a6634263c1b1f6fc4697a04e2b9904ea4b042a89f59dc848a. I can still submit the code normally. , I also tested it at the time, and there are several transfers in the test address I generated to prove it, but why is it not possible now?

user38618: 
The referenced outputs are P2PK
createOutputScript(fromAddress) implies P2PKH
P2PKH scriptSig doesn't match with P2PK pubkeyscript

Resources used to write this three-line answer:

Compile Core
Use 30 GB bandwidth to download the blockchain
Two-three hours of time

but I'm happy to help more if this isn't enough.

113736: <p>When I transferred a 0.001 BTC from <code>miBEA6o6nZcaLZebR1dsDv4AMHRwJk1mbi</code> to <code>miV1sbmLM9fptRfWD5o8hs5L6ucUeJzmp5</code>, the following error occurred: <code>mandatory-script-verify-flag-failed (Signature is found in scriptCode) (code 16)</code>.</p>
<p>This is my broadcast data:</p>
<pre><code>01000000020e920885bc349b3ef0fcecb0acc04c74c59bdfc67d76242fc934f7f9d7d5c915010000006b483045022100dc4681014ce850d2808c82978d92b94f4940ef5ef9c63e3c9f248a0cdf9266df02203cf0344dfbe933d5335ab06da1040cf373d866efe156824e9938ba633bd54591012103a5be350852bb09e24edc83f8e02070a74597a8b775af46e8efbef394ae4fa98effffffff33c8ba1adb1b885e553610e9431bbdbfe14078a1de8ef60d9e29316ea759e8df010000006b483045022100a4cb81427b8613276d458df994d1c9b02aad66fa69be5aef10e71a392a9df10402205b8b919147543aa6c11b12b8b2c44edf498973c6539021cb349ecff674df3f93012103a5be350852bb09e24edc83f8e02070a74597a8b775af46e8efbef394ae4fa98effffffff02a0860100000000001976a914208a8852a3cec93382c8bebbbd6c9ef4676f512088ac8041100000000000232103a5be350852bb09e24edc83f8e02070a74597a8b775af46e8efbef394ae4fa98eac00000000`
</code></pre>
<p>The test method I performed: <a href="https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/test/java/live/lingting/virtual/currency/omni/Transfer.java#L130" rel="nofollow noreferrer">https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/test/java/live/lingting/virtual/currency/omni/Transfer.java#L130</a></p>
<p>Transfer operation, signed code: <a href="https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/main/java/live/lingting/virtual/currency/service/impl/BtcOmniServiceImpl.java#L248" rel="nofollow noreferrer">https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/main/java/live/lingting/virtual/currency/service/impl/BtcOmniServiceImpl.java#L248</a></p>
<p>The signature is at: <a href="https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/main/java/live/lingting/virtual/currency/service/impl/BtcOmniServiceImpl.java#L335" rel="nofollow noreferrer">https://github.com/lingting/VirtualCurrency/blob/0.3.1/src/main/java/live/lingting/virtual/currency/service/impl/BtcOmniServiceImpl.java#L335</a></p>
<p>Signature code:</p>
<pre><code>        List&lt;TransactionInput&gt; inputs = tx.getInputs();
     
    for (int i = 0; i &lt; inputs.size(); i++) {
        Script script = ScriptBuilder.createOutputScript(fromAddress);
        TransactionInput txIn = tx.getInput(i);

        Sha256Hash hash = tx.hashForSignature(i, script, SigHash.ALL, false);
        ECKey.ECDSASignature ecdsaSignature = key.sign(hash);
        TransactionSignature txSignature = new TransactionSignature(ecdsaSignature, SigHash.ALL, false);
        if (ScriptPattern.isP2PK(script)) {
            txIn.setScriptSig(ScriptBuilder.createInputScript(txSignature));
        }
        else if (ScriptPattern.isP2SH(script)) {
            txIn.setScriptSig(ScriptBuilder.createP2SHMultiSigInputScript(ListUtil.toList(txSignature), script));
        }
        else if (ScriptPattern.isP2PKH(script)) {
            txIn.setScriptSig(ScriptBuilder.createInputScript(txSignature, key));
        }
        else if (ScriptPattern.isP2WPKH(script)) {
            Script scriptCode = ScriptBuilder.createP2PKHOutputScript(key);
            TransactionSignature signature = tx.calculateWitnessSignature(i, key, scriptCode, txIn.getValue(),
                    SigHash.ALL, false);
            txIn.setScriptSig(ScriptBuilder.createEmpty());
            txIn.setWitness(TransactionWitness.redeemP2WPKH(signature, key));
        }
        else {
            throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR,
                    &quot;Unable to sign this scriptPubKey: &quot; + script);
        }
    }
</code></pre>
<p>I would like to ask what is wrong with my code. In my submission this time <a href="https://github.com/lingting/VirtualCurrency/commit/0ea9b090d6fe2e4821afc10b5725436d56f2909d#diff-25a6634263c1b1f6fc4697a04e2b9904ea4b042a89f59dc848a" rel="nofollow noreferrer">https://github.com/lingting/VirtualCurrency/commit/0ea9b090d6fe2e4821afc10b5725436d56f2909d#diff-25a6634263c1b1f6fc4697a04e2b9904ea4b042a89f59dc848a</a>. I can still submit the code normally. , I also tested it at the time, and there are several transfers in the test address I generated to prove it, but why is it not possible now?</p>
 38618: <ul>
<li>The referenced outputs are P2PK</li>
<li><code>createOutputScript(fromAddress)</code> implies P2PKH</li>
<li>P2PKH scriptSig doesn't match with P2PK pubkeyscript</li>
</ul>
<p>Resources used to write this three-line answer:</p>
<ul>
<li>Compile Core</li>
<li>Use 30 GB bandwidth to download the blockchain</li>
<li>Two-three hours of time</li>
</ul>
<p>but I'm happy to help more if this isn't enough.</p>
