Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/instantsend/instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ Uint256HashSet GetIdsFromLockable(const std::vector<T>& vec)
if (vec.empty()) return ret;
ret.reserve(vec.size());
for (const auto& in : vec) {
ret.emplace(instantsend::GenInputLockRequestId(in));
if constexpr (std::is_same_v<T, CTxIn>) {
ret.emplace(instantsend::GenInputLockRequestId(in.prevout));
} else {
ret.emplace(instantsend::GenInputLockRequestId(in));
}
}
return ret;
}
Expand Down
7 changes: 2 additions & 5 deletions src/instantsend/lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ bool InstantSendLock::TriviallyValid() const
return inputs_set.size() == inputs.size();
}

template <typename T>
uint256 GenInputLockRequestId(const T& val)
uint256 GenInputLockRequestId(const COutPoint& outpoint)
{
return ::SerializeHash(std::make_pair(INPUTLOCK_REQUESTID_PREFIX, val));
return ::SerializeHash(std::make_pair(INPUTLOCK_REQUESTID_PREFIX, outpoint));
Comment thread
UdjinM6 marked this conversation as resolved.
}
template uint256 GenInputLockRequestId(const COutPoint& val);
template uint256 GenInputLockRequestId(const CTxIn& val);
} // namespace instantsend
3 changes: 1 addition & 2 deletions src/instantsend/lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ struct InstantSendLock {
bool TriviallyValid() const;
};

template <typename T>
uint256 GenInputLockRequestId(const T& val);
uint256 GenInputLockRequestId(const COutPoint& outpoint);

using InstantSendLockPtr = std::shared_ptr<InstantSendLock>;
} // namespace instantsend
Expand Down
4 changes: 2 additions & 2 deletions src/instantsend/signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ bool InstantSendSigner::TrySignInputLocks(const CTransaction& tx, bool fRetroact

size_t alreadyVotedCount = 0;
for (const auto& in : tx.vin) {
auto id = GenInputLockRequestId(in);
auto id = GenInputLockRequestId(in.prevout);
ids.emplace_back(id);

uint256 otherTxHash;
Expand Down Expand Up @@ -344,7 +344,7 @@ void InstantSendSigner::TrySignInstantSendLock(const CTransaction& tx)
const auto llmqType = Params().GetConsensus().llmqTypeDIP0024InstantSend;

for (const auto& in : tx.vin) {
auto id = GenInputLockRequestId(in);
auto id = GenInputLockRequestId(in.prevout);
if (!m_sigman.HasRecoveredSig(llmqType, id, tx.GetHash())) {
return;
}
Expand Down
Loading