htlcswitch: remove batchReplayBkt

This commit removes the `batchReplayBkt` as its only effect is to allow
reforwarding htlcs during startup.

Normally for every incoming htlc added, their shared secret is used as
the key to be saved into the `sharedHashBucket`, which will be used for
check for replays. In addition, the fwdPkg's ID, which is SCID+height is
also saved to the bucket `batchReplayBkt`. Since replays of HTLCs cannot
happen at the same commitment height, when a replay happens,
`batchReplayBkt` simply doesn't have this info, and we again rely on
`sharedHashBucket` to detect it. This means most of the time the
`batchReplayBkt` is a list of SCID+height with empty values.

The `batchReplayBkt` was previously used as a mechanism to check for
reforwardings during startup - when reforwarding htlcs, it quries this
bucket and finds an empty map, knowing this is a forwarding and skips
the check in `sharedHashBucket`. Given now we use a bool flag to
explicitly skip the replay check, this bucket is no longer useful.
This commit is contained in:
yyforyongyu
2025-06-11 12:45:53 +08:00
committed by Olaoluwa Osuntokun
parent c8ff379a9c
commit 13308644d0
2 changed files with 5 additions and 46 deletions

View File

@@ -784,6 +784,8 @@ func (p *OnionProcessor) DecodeHopIterators(id []byte,
b.Val,
))
})
// TODO(yy): use `p.router.ProcessOnionPacket` instead.
err = tx.ProcessOnionPacket(
seqNum, onionPkt, req.RHash, req.IncomingCltv, opts...,
)