-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
Bitcoin P2SH (P2SH-P2PKH) signed transaction's scriptSig includes duplicated redeemScript.
To Reproduce
- Use master branch code, to construct a P2SH-P2PKH transaction for bitcoin
- Use signatures from external, call TWTransactionCompilerCompileWithSignatures() to compile transaction with signatures
- Print this transaction's encoded data
- The scriptSig in the result is: , bellow is an example:
010000000118878442c3861f279eacaf410d76fda1159c1fb6c615a9e5ecde635799a710fc030000009e47304402204107026c76fae27b656f0d756a49be4186a6b5a0c68ed130e3bbc12fdd9b2f67022020b1305ef6c631d6b0391cf3b24eebfa02d102172c253593003365eb174d322801210341d1233a6381b993899a923c9fe2791cc56564c53885a5ffd2a830fae47cd8471976a9148dae2615925abb7ed311bb2e43d57fb91f44a5fe88ac1976a9148dae2615925abb7ed311bb2e43d57fb91f44a5fe88ac32aac7fc02000100000000000017a914b6fef7b1fe91ce5e529cec303ff5a3d6fa69b3ec87660100000000000017a914c3e6d4a96f8f810a8a86a8e7ff9c8040bbb97f898700000000
Expected behavior
The scriptSig in result should be: , likes bellow:
010000000118878442c3861f279eacaf410d76fda1159c1fb6c615a9e5ecde635799a710fc030000008447304402204107026c76fae27b656f0d756a49be4186a6b5a0c68ed130e3bbc12fdd9b2f67022020b1305ef6c631d6b0391cf3b24eebfa02d102172c253593003365eb174d322801210341d1233a6381b993899a923c9fe2791cc56564c53885a5ffd2a830fae47cd8471976a9148dae2615925abb7ed311bb2e43d57fb91f44a5fe88ac32aac7fc02000100000000000017a914b6fef7b1fe91ce5e529cec303ff5a3d6fa69b3ec87660100000000000017a914c3e6d4a96f8f810a8a86a8e7ff9c8040bbb97f898700000000
Screenshots
The related code is in function:
Result<void, Common::Proto::SigningError> SignatureBuilder::sign(Script script, size_t index,
const UTXO& utxo)
file: https://github.com/trustwallet/wallet-core/blob/master/src/Bitcoin/SignatureBuilder.cpp#L60
Additional context
For P2SH-P2WPKH, results is cleared in line 101: https://github.com/trustwallet/wallet-core/blob/master/src/Bitcoin/SignatureBuilder.cpp#L101