Skip to content

Commit 28fd0bc

Browse files
committed
Merge bitcoin/bitcoin#31365: interpreter: Use the same type for SignatureHash in the definition
c288c79 interpreter: Use the same type for SignatureHash in the definition (TheCharlatan) Pull request description: This was missed during the original PR switching the nHashType argument to int32_t in SignatureHash in bc52cda. The problem was discovered after running into a linker error when attempting to link this code as a static library using the header as a declaration with a riscv32 bare metal toolchain. The compiler would error with: ``` /opt/riscv-ilp32/lib/gcc/riscv32-unknown-elf/13.2.0/../../../../riscv32-unknown-elf/bin/ld: build_kernel_riscv/src/libbitcoin_consensus.a(interpreter.cpp.o): in function `GenericTransactionSignatureChecker<CTransaction>::CheckECDSASignature(std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, CScript const&, SigVersion) const': /home/user/bitcoin/build_kernel_riscv/./script/interpreter.cpp:2043:(.text._ZNK34GenericTransactionSignatureCheckerI12CTransactionE19CheckECDSASignatureERKSt6vectorIhSaIhEES6_RK7CScript10SigVersion[_ZNK34GenericTransactionSignatureCheckerI12CTransactionE19CheckECDSASignatureERKSt6vectorIhSaIhEES6_RK7CScript10SigVersion]+0xee): undefined reference to `uint256 SignatureHash<CTransaction>(CScript const&, CTransaction const&, unsigned int, int, long long const&, SigVersion, PrecomputedTransactionData const*)' ``` With this patch it is possible to link against the static consensus library and produce a fully static executable. ACKs for top commit: l0rinc: ACK c288c79 maflcko: review ACK c288c79 🐺 achow101: ACK c288c79 theuni: Obvious fix ACK c288c79. BrandonOdiwuor: Code Review ACK c288c79 Tree-SHA512: 74f283637f0a9cd0cab65d3502f2f8fc4fb983c7672f24e7a76ba2eb6e53b4a81cca0aacb610ef39ac0a454305be594ab440a697ae3718987bf5dbcbc7146a31
2 parents 72ab35a + c288c79 commit 28fd0bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/script/interpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ extern const HashWriter HASHER_TAPLEAF; //!< Hasher with tag "TapLeaf" pre-fe
240240
extern const HashWriter HASHER_TAPBRANCH; //!< Hasher with tag "TapBranch" pre-fed to it.
241241

242242
template <class T>
243-
uint256 SignatureHash(const CScript& scriptCode, const T& txTo, unsigned int nIn, int nHashType, const CAmount& amount, SigVersion sigversion, const PrecomputedTransactionData* cache = nullptr);
243+
uint256 SignatureHash(const CScript& scriptCode, const T& txTo, unsigned int nIn, int32_t nHashType, const CAmount& amount, SigVersion sigversion, const PrecomputedTransactionData* cache = nullptr);
244244

245245
class BaseSignatureChecker
246246
{

0 commit comments

Comments
 (0)