Fix isFromUs and account for channel hashes instead of indexes

This commit is contained in:
Ben Meadors
2025-09-28 06:39:15 -05:00
parent c1e8c28128
commit 87a4a6ab73
4 changed files with 62 additions and 10 deletions
+11
View File
@@ -459,4 +459,15 @@ bool Channels::setDefaultPresetCryptoForHash(ChannelHash channelHash)
int16_t Channels::setActiveByIndex(ChannelIndex channelIndex)
{
return setCrypto(channelIndex);
}
int8_t Channels::getIndexByHash(ChannelHash channelHash)
{
// Iterate through all channels to find the one with matching hash
for (ChannelIndex i = 0; i < getNumChannels(); i++) {
if (getHash(i) == channelHash) {
return i;
}
}
return -1; // Hash not found
}