What changed, and why it matters
This commit is a simple internal rename of a variable from currPaymentSeq to currSeq. It does not change any behavior, logic, or security properties of the code. There is no security issue present.
No action required; this is a non-functional refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff renames the struct field currPaymentSeq to currSeq in KVPaymentsDB and updates all references within nextPaymentSequence(). The sequence-management logic, synchronization, and database interactions remain identical. No functional or security-relevant change is introduced.
Changed components
channeldb/payments_kv_store.goInspect captured patch +6 / −6
diff --git a/channeldb/payments_kv_store.go b/channeldb/payments_kv_store.go
index 703297a..d75b694 100644
--- a/channeldb/payments_kv_store.go
+++ b/channeldb/payments_kv_store.go
@@ -121,7 +121,7 @@ var (
type KVPaymentsDB struct {
// Sequence management for the kv store.
seqMu sync.Mutex
- currPaymentSeq uint64
+ currSeq uint64
storedPaymentSeq uint64
// db is the underlying database implementation.
@@ -762,7 +762,7 @@ func (p *KVPaymentsDB) nextPaymentSequence() ([]byte, error) {
// Set a new upper bound in the DB every 1000 payments to avoid
// conflicts on the sequence when using etcd.
- if p.currPaymentSeq == p.storedPaymentSeq {
+ if p.currSeq == p.storedPaymentSeq {
var currPaymentSeq, newUpperBound uint64
if err := kvdb.Update(p.db, func(tx kvdb.RwTx) error {
paymentsBucket, err := tx.CreateTopLevelBucket(
@@ -785,16 +785,16 @@ func (p *KVPaymentsDB) nextPaymentSequence() ([]byte, error) {
// initialize our stored currPaymentSeq, since by default both
// this variable and storedPaymentSeq are zero which in turn
// will have us fetch the current values from the DB.
- if p.currPaymentSeq == 0 {
- p.currPaymentSeq = currPaymentSeq
+ if p.currSeq == 0 {
+ p.currSeq = currPaymentSeq
}
p.storedPaymentSeq = newUpperBound
}
- p.currPaymentSeq++
+ p.currSeq++
b := make([]byte, 8)
- binary.BigEndian.PutUint64(b, p.currPaymentSeq)
+ binary.BigEndian.PutUint64(b, p.currSeq)
return b, nil
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.