INNER CODE UNIT · Go

func

lightningnetwork/lightning-onion · batch.go:54

func (b *Batch) Put(seqNum uint16, hashPrefix *HashPrefix, cltv uint32) error {
	// Abort if this batch was already written to disk.
	if b.IsCommitted {
		return ErrAlreadyCommitted
	}

	// Check to see if this hash prefix is already included in this batch.
	// If so, we will opportunistically mark this index as replayed.
	if _, ok := b.replayCache[*hashPrefix]; ok {
		b.ReplaySet.Add(seqNum)
		return nil
	}

	// Otherwise, this is a distinct hash prefix for this batch. Add it to
	// our list of entries that we will try to write to disk. Each of these
	// entries will be checked again during the commit to see if any other
	// on-disk entries contain the same hash prefix.
	b.entries[seqNum] = batchEntry{

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…