How do I generate valid signedrawtransaction?

I’m trying to generate signedrawtransaction. Script format is P2SH-P2WPKH. but it cannot send transaction using BTG Wallet. Please let me know how to solve the problem.

Error Message
non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 64) (code -26)

Generated signedrawtransction(hexstring)
0100000000010159134518e193e0a86b5425135a6a99cd6d522f009fd3263321fb4a216b590af40100000017160014ac836d2a2cc8b6d8a6a3bb4ba773e02f4c953833ffffffff02102700000000000017a914d1b7b7480657c10178c91c62b3f14f24b847583087e4190f000000000017a9147974b885e8b6243eed0a24551970dbd02eb5e79487024730440220273e5631d9d11da2f0d3cfbfcfc2b04029ce81b3c788c15b0c60dc39d82a715d022048ab5ec52b95ae9cd069b9c3d1585a00778b9eecf113e4ef3e18878b0348dd464121029ae6a57578d1f591e0650afeefbd8f5cdbf89781fb4bb2da696f3acdd1e87f0c00000000

Decode result of above signedrawtransaction
{
“txid”: “1421323d070d00f87189f14cb292f15213bbe8a54e68d639f5186b2636c274b2”,
“hash”: “b7b23f3adfc0f3650e5f19a666fd955b2e43c11aa132094c0e67adc1af853087”,
“version”: 1,
“size”: 247,
“vsize”: 166,
“weight”: 661,
“locktime”: 0,
“vin”: [
{
“txid”: “f40a596b214afb213326d39f002f526dcd996a5a1325546ba8e093e118451359”,
“vout”: 1,
“scriptSig”: {
“asm”: “0014ac836d2a2cc8b6d8a6a3bb4ba773e02f4c953833”,
“hex”: “160014ac836d2a2cc8b6d8a6a3bb4ba773e02f4c953833”
},
“txinwitness”: [
“30440220273e5631d9d11da2f0d3cfbfcfc2b04029ce81b3c788c15b0c60dc39d82a715d022048ab5ec52b95ae9cd069b9c3d1585a00778b9eecf113e4ef3e18878b0348dd4641”,
“029ae6a57578d1f591e0650afeefbd8f5cdbf89781fb4bb2da696f3acdd1e87f0c”
],
“sequence”: 4294967295
}
],
“vout”: [
{
“value”: 0.00010000,
“n”: 0,
“scriptPubKey”: {
“asm”: “OP_HASH160 d1b7b7480657c10178c91c62b3f14f24b8475830 OP_EQUAL”,
“hex”: “a914d1b7b7480657c10178c91c62b3f14f24b847583087”,
“reqSigs”: 1,
“type”: “scripthash”,
“addresses”: [
“AatkxQ4NVK55gWzR3NkkEPgj4EJxL6aKPp”
]
}
},
{
“value”: 0.00989668,
“n”: 1,
“scriptPubKey”: {
“asm”: “OP_HASH160 7974b885e8b6243eed0a24551970dbd02eb5e794 OP_EQUAL”,
“hex”: “a9147974b885e8b6243eed0a24551970dbd02eb5e79487”,
“reqSigs”: 1,
“type”: “scripthash”,
“addresses”: [
“ASr5EcVPCr3PRNTMdorYBURykL21pqyBge”
]
}
}
]
}

Welcome to any comments and suggestions on this topic. Thank you.

Hi! How did you create and sign the transaction? Most likely you missed SIGHASH_FORKID flag if you are using some library to create such a transaction.