I efficiently created a transaction utilizing a 3-of-4 P2SH script, however the transaction failed when making an attempt with a 5-of-8 P2SH script
mandatory-script-verify-flag-failed (Signature have to be zero for failed CHECK(MULTI)SIG operation) (code 16)
Multisig script
On this script, the accounts have totally different thresholds: Account 1 (1 threshold), Account 2 (2 thresholds), and Account 3 (2 thresholds).
OP_5, 02b509e03e5773ad6864d037eb1c8f9e9c39698bc5b59272d7f2156da2070d810f, 0369cc1b70ded5caf25b42b59ae13bdbee386e5dcaa0612a2a258dec0236404068, 0369cc1b70ded5caf25b42b59ae13bdbee386e5dcaa0612a2a258dec0236404068, 02b8e455ffa2c6a81f454977cec08238273247b28f2d54640101969ee97ab9904c, 02b8e455ffa2c6a81f454977cec08238273247b28f2d54640101969ee97ab9904c, 03515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e8, 03515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e8, 03515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e8, OP_8, OP_CHECKMULTISIG
script sig
[, 3044022007e8bdddd72b19d98c9b071d07d1bce3fd229e61ebff5ecc08dde6349a0498ff022020ac00940280c550e8b8e5608cd676a6e490dd32dedf2e698fe5cbce28e73e2c41, 304402202c10429b2f289375afab14791a1083c8d02a49b61ec43cfa2ab846c1c568f0910220058c706723d940688ba15c4e3bea7915c168a9b271d5e9fd17024f1c2ed90dd841, 304402202c10429b2f289375afab14791a1083c8d02a49b61ec43cfa2ab846c1c568f0910220058c706723d940688ba15c4e3bea7915c168a9b271d5e9fd17024f1c2ed90dd841, 304402207f2c49daaca179bb80801bd29a06194af9753c8295fd2c5d32d344970db0c9a202202954795b717929142198a4b71b28d07434f56331f460930fc02e3d5a1345dc5341, 304402207f2c49daaca179bb80801bd29a06194af9753c8295fd2c5d32d344970db0c9a202202954795b717929142198a4b71b28d07434f56331f460930fc02e3d5a1345dc5341, 552102b509e03e5773ad6864d037eb1c8f9e9c39698bc5b59272d7f2156da2070d810f210369cc1b70ded5caf25b42b59ae13bdbee386e5dcaa0612a2a258dec0236404068210369cc1b70ded5caf25b42b59ae13bdbee386e5dcaa0612a2a258dec02364040682102b8e455ffa2c6a81f454977cec08238273247b28f2d54640101969ee97ab9904c2102b8e455ffa2c6a81f454977cec08238273247b28f2d54640101969ee97ab9904c2103515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e82103515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e82103515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e858ae]
sig hash
SIGHASH_ALL | SIGHASH_FORKED
transaction
0200000001af7c864e4ce68328d8ecb97a07a99e39242dd2d3ef35764f415bef38430af04401000000fd7f0200473044022007e8bdddd72b19d98c9b071d07d1bce3fd229e61ebff5ecc08dde6349a0498ff022020ac00940280c550e8b8e5608cd676a6e490dd32dedf2e698fe5cbce28e73e2c4147304402202c10429b2f289375afab14791a1083c8d02a49b61ec43cfa2ab846c1c568f0910220058c706723d940688ba15c4e3bea7915c168a9b271d5e9fd17024f1c2ed90dd84147304402202c10429b2f289375afab14791a1083c8d02a49b61ec43cfa2ab846c1c568f0910220058c706723d940688ba15c4e3bea7915c168a9b271d5e9fd17024f1c2ed90dd84147304402207f2c49daaca179bb80801bd29a06194af9753c8295fd2c5d32d344970db0c9a202202954795b717929142198a4b71b28d07434f56331f460930fc02e3d5a1345dc534147304402207f2c49daaca179bb80801bd29a06194af9753c8295fd2c5d32d344970db0c9a202202954795b717929142198a4b71b28d07434f56331f460930fc02e3d5a1345dc53414d1301552102b509e03e5773ad6864d037eb1c8f9e9c39698bc5b59272d7f2156da2070d810f210369cc1b70ded5caf25b42b59ae13bdbee386e5dcaa0612a2a258dec0236404068210369cc1b70ded5caf25b42b59ae13bdbee386e5dcaa0612a2a258dec02364040682102b8e455ffa2c6a81f454977cec08238273247b28f2d54640101969ee97ab9904c2102b8e455ffa2c6a81f454977cec08238273247b28f2d54640101969ee97ab9904c2103515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e82103515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e82103515a9b03688488850dd184e9229cb43634c1a39e2ccc5b8f2cf2c0a8cebb92e858aeffffffff02a0860100000000001976a914e54b088d7f501604b1d85ed9d30f46b5db721ac288acaab80d000000000017a914f0115e1442ada4d9e13be0de2d9597e3d3784e608700000000