Skip to content
Merged
Changes from all 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: 6 additions & 0 deletions sphinx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"math/big"
"sync"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
Expand Down Expand Up @@ -701,6 +702,8 @@ type Tx struct {
// only be accessed if the index is *not* included in the replay set, or
// otherwise failed any other stage of the processing.
packets []ProcessedPacket

sync.Mutex
}

// BeginTxn creates a new transaction that can later be committed back to the
Expand Down Expand Up @@ -751,6 +754,9 @@ func (t *Tx) ProcessOnionPacket(seqNum uint16, onionPkt *OnionPacket,
return err
}

t.Lock()
defer t.Unlock()

// Add the hash prefix to pending batch of shared secrets that will be
// written later via Commit().
err = t.batch.Put(seqNum, hashPrefix, incomingCltv)
Expand Down